diff --git a/src/Drupal/Driver/Fields/Drupal8/LinkHandler.php b/src/Drupal/Driver/Fields/Drupal8/LinkHandler.php index a6c87bf..d7d5fe9 100644 --- a/src/Drupal/Driver/Fields/Drupal8/LinkHandler.php +++ b/src/Drupal/Driver/Fields/Drupal8/LinkHandler.php @@ -11,21 +11,22 @@ class LinkHandler extends AbstractHandler { * {@inheritdoc} */ public function expand($values) { - $return = []; + $return_values = []; foreach ($values as $value) { // 'options' is required to be an array, otherwise the utility class // Drupal\Core\Utility\UnroutedUrlAssembler::assemble() will complain. - $options = []; - if (!empty($value[2])) { - parse_str($value[2], $options); - } - $return[] = [ - 'options' => $options, - 'title' => $value[0], - 'uri' => $value[1], + $return_value = [ + 'title' => $value['title'] ?? $value[0] ?? NULL, + 'uri' => $value['uri'] ?? $value[1] ?? NULL, + 'options' => [], ]; + $options = $value['options'] ?? $value[2] ?? NULL; + if ($options) { + parse_str($options, $return_value['options']); + } + $return_values[] = $return_value; } - return $return; + return $return_values; } }