Problem/Motivation
Spotted while reviewing #3023638: Remove unused 'options' from SystemManager::getAdminBlock, template_preprocess_admin_block_content() has this docblock:
* @param $variables
* An associative array containing:
* - content: An array containing information about the block. Each element
* of the array represents an administrative menu item, and must at least
* contain the keys 'title', 'link_path', and 'localized_options', which are
* passed to l(). A 'description' key may also be provided.
This is out of date. l() doesn't even exist any more and some of the other array key names are wrong.
Similarly this is carried through to templates, system.module's admin-block-content.html.twig mentions:
* Available variables:
* - content: A list containing information about the block. Each element
* of the array represents an administrative menu item, and must at least
* contain the keys 'title', 'link_path', and 'localized_options', which are
* passed to l(). A 'description' key may also be provided.
stable and stable9 also have the same docblock, all of these are out of date.
Proposed resolution
Discover the available variables. Fix the preprocess and template documentation to match.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #3
ramya balasubramanian commentedHi @longwave,
Uploaded the patch. Please have a look and let me know if there are any issues.
Comment #4
abhijith s commentedApplied patch #3 and it works fine.The deprecated l() and its description is removed from those templates.There is no white-space found, also the new description given is meaningful in the scenario.
I'm moving it to RTBC.
Comment #5
abhijith s commentedComment #6
alexpottI think we're missing
optionslooking at \Drupal\system\SystemManager::getAdminBlock()Comment #7
ramya balasubramanian commentedHi @alexpott,
Updated the options. Please have a look.
Comment #8
pfrenssenThe documentation is not fully clear:
+ * - options: The array of options.This doesn't explain what these options are used for. They are in fact not used in the theme layer right now, but we can derive the meaning from
MenuLinkInterface. How about this?+ * - options: Options to use when creating the URL. See \Drupal\Core\Url::fromUri() for details.Comment #10
pfrenssenComment #11
pfrenssenI had a look in the theme layer which context variables are actually available using Twig debugging. The formatted
linkis there in addition to theurl(actually this is a URI not a URL but we cannot change this without breaking B/C) andoptionscomponents. Updated documentation accordingly.Comment #12
longwaveLooks good to me. RTBC if bot agrees, as this is docs changes only I don't see why it wouldn't.
Comment #13
pfrenssenThanks for the quick review!
Comment #15
catch@Abhijith S there's no need to upload a screenshot to show the patch applying since d.o's testing infrastructure tells us this information already.
Committed f6205a6 and pushed to 9.2.x. Thanks!