annotate core/modules/contextual/contextual.api.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /**
Chris@0 4 * @file
Chris@0 5 * Hooks provided by Contextual module.
Chris@0 6 */
Chris@0 7
Chris@0 8 /**
Chris@0 9 * @addtogroup hooks
Chris@0 10 * @{
Chris@0 11 */
Chris@0 12
Chris@0 13 /**
Chris@0 14 * Alter a contextual links element before it is rendered.
Chris@0 15 *
Chris@0 16 * This hook is invoked by contextual_pre_render_links(). The renderable array
Chris@0 17 * of #type 'contextual_links', containing the entire contextual links data that
Chris@0 18 * is passed in by reference. Further links may be added or existing links can
Chris@0 19 * be altered.
Chris@0 20 *
Chris@0 21 * @param $element
Chris@0 22 * A renderable array representing the contextual links.
Chris@0 23 * @param $items
Chris@0 24 * An associative array containing the original contextual link items, as
Chris@0 25 * generated by
Chris@0 26 * \Drupal\Core\Menu\ContextualLinkManagerInterface::getContextualLinksArrayByGroup(),
Chris@0 27 * which were used to build $element['#links'].
Chris@0 28 *
Chris@0 29 * @see hook_contextual_links_alter()
Chris@0 30 * @see hook_contextual_links_plugins_alter()
Chris@0 31 * @see contextual_pre_render_links()
Chris@0 32 */
Chris@0 33 function hook_contextual_links_view_alter(&$element, $items) {
Chris@0 34 // Add another class to all contextual link lists to facilitate custom
Chris@0 35 // styling.
Chris@0 36 $element['#attributes']['class'][] = 'custom-class';
Chris@0 37 }
Chris@0 38
Chris@0 39 /**
Chris@0 40 * @} End of "addtogroup hooks".
Chris@0 41 */