Skip to content

Commit 73c4c8e

Browse files
committed
Allow D8 link handler to work with named field properties
jhedstromgh-192
1 parent 5a92b22 commit 73c4c8e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/Drupal/Driver/Fields/Drupal8/LinkHandler.php

+11-10
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@ class LinkHandler extends AbstractHandler {
1111
* {@inheritdoc}
1212
*/
1313
public function expand($values) {
14-
$return = [];
14+
$return_values = [];
1515
foreach ($values as $value) {
1616
// 'options' is required to be an array, otherwise the utility class
1717
// Drupal\Core\Utility\UnroutedUrlAssembler::assemble() will complain.
18-
$options = [];
19-
if (!empty($value[2])) {
20-
parse_str($value[2], $options);
21-
}
22-
$return[] = [
23-
'options' => $options,
24-
'title' => $value[0],
25-
'uri' => $value[1],
18+
$return_value = [
19+
'title' => $value['title'] ?? $value[0] ?? NULL,
20+
'uri' => $value['uri'] ?? $value[1] ?? NULL,
21+
'options' => [],
2622
];
23+
$options = $value['options'] ?? $value[2] ?? NULL;
24+
if ($options) {
25+
parse_str($options, $return_value['options']);
26+
}
27+
$return_values[] = $return_value;
2728
}
28-
return $return;
29+
return $return_values;
2930
}
3031

3132
}

0 commit comments

Comments
 (0)