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.
Problem/Motivation
#2845485: Refactor and document the MenuLinkParent process plugin recently landed (yay). However, @benjifisher points out that we added this code sample:
* Example:
*
* @code
* process:
* parent:
* plugin: menu_link_parent
* source:
* - 20
* - management
* - admin/structure
* @endcode
We should have source keys for those 3 values, not the raw values themselves.
Steps to reproduce
- Open core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php with a text editor.
- Read the opening PHPDoc comment for the class.
Proposed resolution
Use something valid in this example code block. E.g. working usage from core/modules/menu_link_content/migrations/d7_menu_links.yml
:
parent:
plugin: menu_link_parent
source:
- plid
- '@menu_name'
- parent_link_path
Remaining tasks
Do it.- Reviews/refinements.
- RTBC.
- Commit.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Comment | File | Size | Author |
---|---|---|---|
#11 | 3164120-11.patch | 1.18 KB | dww |
Comments
Comment #2
dwwWhoops. ;)
Comment #4
dwwCrediting @benjifisher for finding this and pointing it out via Slack
Comment #5
dwwAlso, with an eye to #3158562: Consistently refer to "menu links" as that, not "menu items", in the UI, we should consistently refer to these as "menu links" not "menu items" or "menu item links", etc. ;)
Here's a patch to get us started. If we're really going to use '@menu_name' it seems like the example should show 'menu_name' being defined earlier in the migration. Perhaps that's bloat. I'm flexible. Feel free to shred this to pieces. ;)
Thanks,
-Derek
Comment #6
quietone CreditAttribution: quietone as a volunteer commentedGood find by benjifisher!
The patch looks good. Just a few things to make it consistent in the language.
I'm not convinced that this is needed. But it also makes the example more complete, so that is good.
I think this can be simpler, (e.g. '20') and not lose meaning.
s/something like/e.g./
Comment #7
dwwThanks for the quick review, @quietone! Re #6:
1. Leaving alone for now.
2. Fixed.
3. Fixed.
Cheers,
-Derek
Comment #8
quietone CreditAttribution: quietone as a volunteer commented@dww, thanks for making those changes. I am happy with this now.
I would set to RTBC but I'd like another set of eyes on it because we dww and I missed this in the earlier patch.
Comment #9
benjifisherThanks for the quick action on this issue, @dww and @quietone.
I think that adding the
menu_name
target makes the example more realistic but also more complicated. Let's just replace'@menu_name'
withmenu_name
and rely on the comment that follows.I was taught that "e.g." is always followed by a comma. Ideally, it should also be italicized, but that is not an option here.
plid
represents an ID in the source? So the process plugin does an implicitmigration_lookup
? That is weird, but fixing it would be out of scope and disruptive.Putting all those suggestions together, this is my suggested comment (after the
@endcode
):Comment #10
benjifisherComment #11
dwwThanks, @benjifisher: that all sounds great to me. Definitely more succinct and clear.
Comment #12
dwwReviews/refinements.;)RTBC?
Thanks,
-Derek
Comment #13
benjifisher@dww, thanks for the update.
Yes, that looks good to me: RTBC.
Comment #14
catchCommitted f5f925c and pushed to 9.1.x. Thanks!