Issue #3240915 by andypost, alexpott: Passing NULL to \Drupal\Component\Utility\Unicode::truncate() causes deprecations on PHP 8.1
parent
adf864ee84
commit
caf0971080
|
@ -63,7 +63,7 @@ class LinkSeparateFormatter extends LinkFormatter {
|
||||||
}
|
}
|
||||||
$url_title = $url->toString();
|
$url_title = $url->toString();
|
||||||
if (!empty($settings['trim_length'])) {
|
if (!empty($settings['trim_length'])) {
|
||||||
$link_title = Unicode::truncate($link_title, $settings['trim_length'], FALSE, TRUE);
|
$link_title = $link_title !== NULL ? Unicode::truncate($link_title, $settings['trim_length'], FALSE, TRUE) : NULL;
|
||||||
$url_title = Unicode::truncate($url_title, $settings['trim_length'], FALSE, TRUE);
|
$url_title = Unicode::truncate($url_title, $settings['trim_length'], FALSE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,10 @@ class MenuLink extends DrupalSqlBase {
|
||||||
}
|
}
|
||||||
$row->setSourceProperty('options', unserialize($row->getSourceProperty('options')));
|
$row->setSourceProperty('options', unserialize($row->getSourceProperty('options')));
|
||||||
$row->setSourceProperty('enabled', !$row->getSourceProperty('hidden'));
|
$row->setSourceProperty('enabled', !$row->getSourceProperty('hidden'));
|
||||||
$row->setSourceProperty('description', Unicode::truncate($row->getSourceProperty('options/attributes/title'), 255));
|
$description = $row->getSourceProperty('options/attributes/title');
|
||||||
|
if ($description !== NULL) {
|
||||||
|
$row->setSourceProperty('description', Unicode::truncate($description, 255));
|
||||||
|
}
|
||||||
|
|
||||||
return parent::prepareRow($row);
|
return parent::prepareRow($row);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue