Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
36
vendor/chi-teck/drupal-code-generator/templates/d7/hook/preprocess.twig
vendored
Normal file
36
vendor/chi-teck/drupal-code-generator/templates/d7/hook/preprocess.twig
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Implements hook_preprocess().
|
||||
*/
|
||||
function {{ machine_name }}_preprocess(&$variables, $hook) {
|
||||
static $hooks;
|
||||
|
||||
// Add contextual links to the variables, if the user has permission.
|
||||
|
||||
if (!user_access('access contextual links')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($hooks)) {
|
||||
$hooks = theme_get_registry();
|
||||
}
|
||||
|
||||
// Determine the primary theme function argument.
|
||||
if (isset($hooks[$hook]['variables'])) {
|
||||
$keys = array_keys($hooks[$hook]['variables']);
|
||||
$key = $keys[0];
|
||||
}
|
||||
else {
|
||||
$key = $hooks[$hook]['render element'];
|
||||
}
|
||||
|
||||
if (isset($variables[$key])) {
|
||||
$element = $variables[$key];
|
||||
}
|
||||
|
||||
if (isset($element) && is_array($element) && !empty($element['#contextual_links'])) {
|
||||
$variables['title_suffix']['contextual_links'] = contextual_links_view($element);
|
||||
if (!empty($variables['title_suffix']['contextual_links'])) {
|
||||
$variables['classes_array'][] = 'contextual-links-region';
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue