function contextual_preprocess
contextual_preprocess(&$variables, $hook)
Implements hook_preprocess().
See also
File
- modules/contextual/contextual.module, line 84
- Adds contextual links to perform actions related to elements on a page.
Code
function contextual_preprocess(&$variables, $hook) { // Nothing to do here if the user is not permitted to access contextual links. if (!user_access('access contextual links')) { return; } $hooks = theme_get_registry(FALSE); // Determine the primary theme function argument. if (!empty($hooks[$hook]['variables'])) { $keys = array_keys($hooks[$hook]['variables']); $key = $keys[0]; } elseif (!empty($hooks[$hook]['render element'])) { $key = $hooks[$hook]['render element']; } if (!empty($key) && isset($variables[$key])) { $element = $variables[$key]; } if (isset($element) && is_array($element) && !empty($element['#contextual_links'])) { // Initialize the template variable as a renderable array. $variables['title_suffix']['contextual_links'] = array( '#type' => 'contextual_links', '#contextual_links' => $element['#contextual_links'], '#element' => $element, ); // Mark this element as potentially having contextual links attached to it. $variables['classes_array'][] = 'contextual-links-region'; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!contextual!contextual.module/function/contextual_preprocess/7.x