
Problem/Motivation
First reported in #2977669: Spec Compliance: some entity types have an "id", "type" or "uuid" field, this violates the spec.
This makes it impossible to expose the relationship between MenuLinkContent
and Menu
entities:
$fields['menu_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Menu name'))
->setDescription(t('The menu name. All links with the same menu name (such as "tools") are part of the same menu.'))
->setDefaultValue('tools')
->setSetting('is_ascii', TRUE);
Proposed resolution
$fields['menu'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Menu'))
->setDescription(t('The menu this link is part of.');
Remaining tasks
TBD
User interface changes
TBd
API changes
TBD
Data model changes
Yes!
Comment | File | Size | Author |
---|---|---|---|
#25 | 9.1.x-dev.png | 156.69 KB | rajandro |
#24 | Screen Shot 2020-06-29 at 12.49.28 PM.png | 69.25 KB | sharma.amitt16 |
#22 | interdiff_19-22.txt | 971 bytes | raunak.singh |
#22 | menu-name-is-a-string-field-2984224-22.patch | 6.29 KB | raunak.singh |
#19 | menu-name-is-a-string-field-2984224-19.patch | 6.26 KB | bunty badgujar |
Comments
Comment #3
bn_code CreditAttribution: bn_code at EPAM Systems commentedComment #4
bn_code CreditAttribution: bn_code at EPAM Systems commentedHas been added.
Comment #5
bn_code CreditAttribution: bn_code at EPAM Systems commentedComment #7
bn_code CreditAttribution: bn_code at EPAM Systems commentedComment #8
rodman1980 CreditAttribution: rodman1980 at EPAM Systems commentedComment #12
mrinalini9 CreditAttribution: mrinalini9 at Material for Drupal India Association commentedComment #13
mrinalini9 CreditAttribution: mrinalini9 at Material for Drupal India Association commentedComment #14
mrinalini9 CreditAttribution: mrinalini9 at Material for Drupal India Association commentedHi,
Here is the rerolled patch.
Thanks
Mrinalini
Comment #15
bunty badgujar CreditAttribution: bunty badgujar commentedWe need to add hook_update_N to install new FieldStorageDefinition in #14.
Comment #16
Lal_Comment #18
mrinalini9 CreditAttribution: mrinalini9 at Material for Drupal India Association commentedComment #19
bunty badgujar CreditAttribution: bunty badgujar commentedRe-rolling #15 with test case issue fix.
Comment #21
raunak.singh CreditAttribution: raunak.singh as a volunteer and at Material for Drupal India Association commentedI will create the patch passing the test cases.
Comment #22
raunak.singh CreditAttribution: raunak.singh as a volunteer and at Material for Drupal India Association commentedRe-rolling #19 with test case issue fix.
Comment #24
sharma.amitt16 CreditAttribution: sharma.amitt16 as a volunteer and at Material for Drupal India Association commentedWe are adding a new column menu in the menu_link_content table while the menu_name is already there for the same purpose. This is a redundancy.
Also, the description given for the field is a little bit confusing.
Shouldn't we modify the existing field or remove the existing if we are trying to use a new one.
Test cases are getting failed because we are adding a reference field but not passing the value of this in test cases. We should pass the menu in test cases.
In core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php
The existing menu_name field may be used in some other places as well as in core and contributed both. So we can't remove the field directly. We need to have a plan to use/remove this.
Comment #25
rajandro CreditAttribution: rajandro as a volunteer and at Material for Drupal India Association commentedRemoving

Needs reroll
tag as patch #22 (menu-name-is-a-string-field-2984224-22.patch) is working fine with the current core version.Comment #29
quietone CreditAttribution: quietone at PreviousNext commentedDiscussed in #bugsmash with larowlan. I agree with him that this is not bug and is either a task or feature request. I think task is a better fit and keeping at major.