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
Menu Attributes provides hook_menu_attributes_info to allow additional Form API elements to be included for saving within menu item options. This includes text_format Form API elements. However, text_format saves its value/format combination in the format
$text_format_value = array(
'value' => $text_value,
'format' => $text_format,
);
_menu_attributes_form_alter() does not account for this structure when setting the #default_value of its form elements, and so the saved text_format value/format combination is not loaded correctly into the form.
Proposed resolution
The attached patch has handling for the default value of text_format form elements.
Comment | File | Size | Author |
---|---|---|---|
#1 | menu_attributes-text_format_handling-1971288-1.patch | 869 bytes | timcosgrove |
menu_attributes_text_format_handling.patch | 869 bytes | timcosgrove | |
Comments
Comment #1
timcosgrove CreditAttribution: timcosgrove commentedPatch renamed according to issue number.
Comment #2
shanethehat CreditAttribution: shanethehat commentedComment #2.0
shanethehat CreditAttribution: shanethehat commentedSpelling correction.
Comment #3
joelpittetThis is a simple enough patch, thank you. Just need a bit more information on this. Can you provide the use case for when this is needed? That way we know what problem it will help solve and maybe can add a test to make sure it keeps on being solved going forward.
Comment #4
joelpittetThis has been waiting for a response for a while, closing to triage the queue. Feel free to reopen if there is a use-case that I'm missing/don't understand.