The plugin definition supports options for contextual links but they are ignored when rendering.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 2892942-16.patch | 4.44 KB | wim leers |
| #16 | 2892942-16-test_only_FAIL.patch | 3.55 KB | wim leers |
The plugin definition supports options for contextual links but they are ignored when rendering.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 2892942-16.patch | 4.44 KB | wim leers |
| #16 | 2892942-16-test_only_FAIL.patch | 3.55 KB | wim leers |
Comments
Comment #2
chi commentedComment #3
chi commentedRemoved unnecessarily changes.
Comment #4
wim leersGood catch :)
Comment #5
gábor hojtsyComment #8
gábor hojtsySimple and straightforward, good find indeed. Committed.
Comment #11
xjmOops, looks like we missed the test coverage for this. I've reverted so we can add an explicit test. Thanks!
Comment #12
eric_a commentedComment #13
wim leersWorking on test coverage.
Comment #14
wim leersNote this is a blocker of #2893978: Use newly supported 'options' in contextual links in Settings Tray contextual links.
Comment #15
wim leersThe test coverage for this was forgotten in #2084463: Convert contextual links to a plugin system similar to local tasks/actions.
Comment #16
wim leersHere's the requested test coverage. The test-only patch is also the interdiff.
Comment #17
tedbowI don't really understand how this change relates to this test coverage.
Comment #18
wim leersYou're right, that's pure clean-up. I made that change because I first thought there was a bug in that original code. After a bunch of debugging, it turned out to be correct. But this is just so much simpler that I figured I'd keep it.
I can remove it if you prefer.
Comment #19
tedbow@Wim Leers thanks for explanation. Leaving it seems fine
RTBC. The non-test code was already reviewed and committed once. And the test coverage looks good. Tests will kick back if I am wrong.
Comment #21
lauriiiI'm not sure, but should we add the new array item to the doc block since if someone sets that array item in the #contextual_links array, it overrides the plugin value.
Comment #22
tedbow@laurii I don't think we need a comment specify that you can not pass "options" or "localized_options" in
$element['#contextual_links']The doc block for \Drupal\contextual\Element\ContextualLinks::preRenderLinks for says exactly what keys can be passed in
$element['#contextual_links']so I don't think
Nowhere does it specify that these will be used as parameters to
Url::fromRoute(). So you can't say overriding a key in the array we just not passing it on. This would have been true before this patch. If you set$element['#contextual_links']['options']or$element['#contextual_links']['localized_options']these would not be used in making the renderable array representing contextual links that function returns."route_name" is in the same situation. If you passed $element['#contextual_links']['localized_options']["route_name]" it would not be used.
Only the 2 keys specifically in the doc block will be used in $element['#contextual_links'].
Comment #24
lauriii@tedbow thank you for explaining. My comment was incorrect and there's no reason to add any documentation about this doesn't make any API changes.
Committed 4c8c5e1 and pushed to 8.4.x. Thanks!
Comment #25
tedbow@lauriii thanks for the commit and review. Also good to raise the concern, better to mention something that turns out not be a problem than not to mention something that turns out to be problem 🏅😀
Comment #27
wim leersYay!
And yep, this is merely making the API actually do/support what the API docs say!