Problem/Motivation
While doing some D8 migration testing #2233883: Link migration needs to convert source url into the appropriate route format for storage, an issue was found that may be partly caused by the Link module not properly handling having no options (URL fragment, query, and attributes) when programmatically saved.
Proposed resolution
Fix core to allow saving programmatically when the options are null.
( Do not rely on the loading and saving the form, which forces a call to /Drupal/Link/Plugin/Field/FieldWidget/LinkWidget massageFormValues() )
Remaining tasks
- Write a test that saves a link with no options programmatically that fails. :) https://drupal.org/contributor-tasks/write-tests
User interface changes
No.
API changes
No.
Comment | File | Size | Author |
---|---|---|---|
#1 | linkitemtestnooptions-2242779-1.patch | 4.5 KB | ultimike |
Comments
Comment #1
ultimikeComment #2
YesCT CreditAttribution: YesCT commentedsending to testbot to see what it says.
Comment #3
YesCT CreditAttribution: YesCT commentedPutting issue summary template in summary. using [#NNNNN] to link issues.
Moving narrative here from the issue summary:
@ultimike
Comment #4
YesCT CreditAttribution: YesCT commentedtagging for needs tests.
Also, if we have any examples in core of programmatically saving a node with a link without options, linking to it here would be most helpful.
Comment #5
amateescu CreditAttribution: amateescu commentedI think this should be fixed by the patch in #2235457: Use link field for shortcut entity.
Comment #6
ultimikeAfter chatting on IRC with timplunkett, I'm going to go ahead an apply the patch that amateescu referred to in comment 5 and see if that solves/helps the problem.
-mike
Comment #7
ultimikeYep, this patch solves the D6->D8 migration issue I've been hitting (https://drupal.org/comment/8663303#comment-8663303)!
Thanks,
-mike
Comment #8
ultimikeStill waiting for https://drupal.org/node/2235457 to be committed to core...
-mike
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedThe proposed solution, #2235457: Use link field for shortcut entity no longer applies, and cannot be re-rolled for PSR-4.
I tried to re-roll this patch for PSR-4. The result was an error "Fatal error: Unsupported operand types in /var/www/drupal/core/lib/Drupal/Core/Routing/UrlGenerator.php on line 242". Same result as the other patch.