Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When looking at this code, being part of LinksWidget.php in the buildListItems
method:
$items = [
'#markup' => $link->toString(),
'#wrapper_attributes' => [
'class' => $classes,
],
'children' => [$children_markup],
];
We are essentially rendering the Link already in the build method.
Feels like we are mixing up the build + the render phase? Asking if we can improve this :)
Comment | File | Size | Author |
---|---|---|---|
#5 | 2696997-5.patch | 1.65 KB | marthinal |
#2 | can_we_avoid_tostring-2696997-2.patch | 741 bytes | borisson_ |
Comments
Comment #2
borisson_I think we can, the integration test should pass, if all the tests pass this can go in. This is a great idea, thanks so much for the suggestion.
Comment #5
marthinal CreditAttribution: marthinal commented@borisson_ @dasjo
If I understand correctly, the link should be built as an array in this phase(build).
Comment #6
borisson_Sure, that sounds like a great idea.
Comment #8
marthinal CreditAttribution: marthinal commentedGreat! thanks guys