Commit caf09710 authored by catch's avatar catch
Browse files

Issue #3240915 by andypost, alexpott: Passing NULL to...

Issue #3240915 by andypost, alexpott: Passing NULL to \Drupal\Component\Utility\Unicode::truncate() causes deprecations on PHP 8.1
parent adf864ee
......@@ -63,7 +63,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
}
$url_title = $url->toString();
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);
}
......
......@@ -111,7 +111,10 @@ public function prepareRow(Row $row) {
}
$row->setSourceProperty('options', unserialize($row->getSourceProperty('options')));
$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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment