Problem/Motivation
MenuLinkDefaultForm::extractFormValues() is documented as returning the plugin definition, but the ID (part of the definition) is not included.
Proposed resolution
Make sure the returned definition includes a value for ID and every other definition key.
Remaining tasks
\Drupal\Core\Menu\Form\MenuLinkFormInterface::extractFormValuesshould document that it has to return the plugin ID as well- Write some unit test for
\Drupal\Core\Menu\Form\MenuLinkDefaultForm::extractFormValuesto ensure the plugin ID is returned
User interface changes
n/a
API changes
n/a
Data model changes
Additional array keys present in return value
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 2660486-12.patch | 4.47 KB | dawehner |
Comments
Comment #2
pwolanin commentedComment #3
wim leersComment #4
pwolanin commentedSmall fix to make sure the ID is consistent.
Comment #5
pwolanin commentedPlus some code comments
Comment #6
dawehnerI'm wondering whether we can have some form of test coverage to ensure this is actually working as expected?
Comment #7
dawehnerNote: We should also make it clear in the documentation that the method is supposed to return the plugin ID as well.
Comment #8
dawehnerLinked the related issue.
Comment #9
dawehnerComment #10
jibranWe also need tests.
Comment #11
rrrob commentedAdd
\Drupal\Core\Menu\Form\MenuLinkFormInterface::extractFormValuesdocumentation.Comment #12
dawehnerAdded a test as well
Comment #13
jibranThanks for the tests.
Comment #14
catchCommitted/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!
Comment #17
rrrob commented@pwolanin in my tests,
$form_state->getValue('id')is sometimesnull, overwriting$new_definition['id']which actually has a validid.In what cases were you seeing
$new_definition['id']not being present?