2002-12-24 15:40:32 +00:00
|
|
|
<?php
|
2003-12-27 21:29:20 +00:00
|
|
|
|
2004-07-22 16:06:54 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* API for the Drupal menu system.
|
|
|
|
*/
|
|
|
|
|
2003-12-17 22:15:35 +00:00
|
|
|
/**
|
2015-01-22 19:24:44 +00:00
|
|
|
* @addtogroup menu
|
2003-12-17 22:15:35 +00:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2018-05-01 15:14:09 +00:00
|
|
|
use Drupal\Component\Render\FormattableMarkup;
|
2015-01-22 19:24:44 +00:00
|
|
|
|
2007-07-04 15:49:44 +00:00
|
|
|
/**
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
* Prepares variables for single local task link templates.
|
2007-12-06 09:58:34 +00:00
|
|
|
*
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
* Default template: menu-local-task.html.twig.
|
|
|
|
*
|
|
|
|
* @param array $variables
|
2009-10-09 01:00:08 +00:00
|
|
|
* An associative array containing:
|
2010-04-13 15:23:03 +00:00
|
|
|
* - element: A render element containing:
|
2015-02-03 09:59:20 +00:00
|
|
|
* - #link: A menu link array with 'title', 'url', and (optionally)
|
|
|
|
* 'localized_options' keys.
|
2010-04-13 15:23:03 +00:00
|
|
|
* - #active: A boolean indicating whether the local task is active.
|
2007-07-04 15:49:44 +00:00
|
|
|
*/
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
function template_preprocess_menu_local_task(&$variables) {
|
2009-10-11 06:05:53 +00:00
|
|
|
$link = $variables['element']['#link'];
|
2017-03-04 01:20:24 +00:00
|
|
|
$link += [
|
|
|
|
'localized_options' => [],
|
|
|
|
];
|
2014-12-13 20:44:18 +00:00
|
|
|
$link_text = $link['title'];
|
2009-11-08 12:30:35 +00:00
|
|
|
|
|
|
|
if (!empty($variables['element']['#active'])) {
|
2015-04-18 15:48:42 +00:00
|
|
|
$variables['is_active'] = TRUE;
|
2009-11-08 12:30:35 +00:00
|
|
|
|
2015-03-09 15:57:27 +00:00
|
|
|
// Add text to indicate active tab for non-visual users.
|
2018-05-01 15:14:09 +00:00
|
|
|
$active = new FormattableMarkup('<span class="visually-hidden">@label</span>', ['@label' => t('(active tab)')]);
|
2017-03-04 01:20:24 +00:00
|
|
|
$link_text = t('@local-task-title@active', ['@local-task-title' => $link_text, '@active' => $active]);
|
2009-11-08 12:30:35 +00:00
|
|
|
}
|
2015-03-09 15:57:27 +00:00
|
|
|
|
2014-01-23 18:04:41 +00:00
|
|
|
$link['localized_options']['set_active_class'] = TRUE;
|
|
|
|
|
2017-03-04 01:20:24 +00:00
|
|
|
$variables['link'] = [
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
'#type' => 'link',
|
2014-12-13 20:44:18 +00:00
|
|
|
'#title' => $link_text,
|
2014-10-09 06:39:37 +00:00
|
|
|
'#url' => $link['url'],
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
'#options' => $link['localized_options'],
|
2017-03-04 01:20:24 +00:00
|
|
|
];
|
2003-09-28 10:51:40 +00:00
|
|
|
}
|
2002-12-24 15:40:32 +00:00
|
|
|
|
2009-08-22 19:58:28 +00:00
|
|
|
/**
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
* Prepares variables for single local action link templates.
|
2009-08-22 19:58:28 +00:00
|
|
|
*
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
* Default template: menu-local-action.html.twig.
|
|
|
|
*
|
|
|
|
* @param array $variables
|
2009-10-09 01:00:08 +00:00
|
|
|
* An associative array containing:
|
2010-04-13 15:23:03 +00:00
|
|
|
* - element: A render element containing:
|
2015-02-03 09:59:20 +00:00
|
|
|
* - #link: A menu link array with 'title', 'url', and (optionally)
|
|
|
|
* 'localized_options' keys.
|
2009-08-22 19:58:28 +00:00
|
|
|
*/
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
function template_preprocess_menu_local_action(&$variables) {
|
2009-10-11 06:05:53 +00:00
|
|
|
$link = $variables['element']['#link'];
|
2017-03-04 01:20:24 +00:00
|
|
|
$link += [
|
|
|
|
'localized_options' => [],
|
|
|
|
];
|
2012-11-19 11:43:55 +00:00
|
|
|
$link['localized_options']['attributes']['class'][] = 'button';
|
2013-01-02 12:00:25 +00:00
|
|
|
$link['localized_options']['attributes']['class'][] = 'button-action';
|
2014-01-23 18:04:41 +00:00
|
|
|
$link['localized_options']['set_active_class'] = TRUE;
|
2009-12-03 20:21:50 +00:00
|
|
|
|
2017-03-04 01:20:24 +00:00
|
|
|
$variables['link'] = [
|
Issue #1898478 by joelpittet, Cottser, lokapujya, m1r1k, jstoller, er.pushpinderrana, duellj, organicwire, jessebeach, idflood, Jalandhar, Risse, derheap, galooph, mike.roberts, tlattimore, nadavoid, LinL, steveoliver, chakrapani, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, m86 | c4rl: Menu.inc - Convert theme_ functions to Twig.
2014-09-09 16:12:26 +00:00
|
|
|
'#type' => 'link',
|
|
|
|
'#title' => $link['title'],
|
|
|
|
'#options' => $link['localized_options'],
|
2014-10-09 06:39:37 +00:00
|
|
|
'#url' => $link['url'],
|
2017-03-04 01:20:24 +00:00
|
|
|
];
|
2009-08-22 19:58:28 +00:00
|
|
|
}
|
|
|
|
|
2007-07-25 14:44:03 +00:00
|
|
|
/**
|
2012-08-31 15:56:36 +00:00
|
|
|
* Returns an array containing the names of system-defined (default) menus.
|
2007-07-25 14:44:03 +00:00
|
|
|
*/
|
|
|
|
function menu_list_system_menus() {
|
2017-03-04 01:20:24 +00:00
|
|
|
return [
|
2012-10-25 15:53:18 +00:00
|
|
|
'tools' => 'Tools',
|
|
|
|
'admin' => 'Administration',
|
|
|
|
'account' => 'User account menu',
|
|
|
|
'main' => 'Main navigation',
|
2012-11-20 11:36:51 +00:00
|
|
|
'footer' => 'Footer menu',
|
2017-03-04 01:20:24 +00:00
|
|
|
];
|
2007-07-25 14:44:03 +00:00
|
|
|
}
|
|
|
|
|
2008-01-28 16:05:17 +00:00
|
|
|
/**
|
2015-01-22 19:24:44 +00:00
|
|
|
* @} End of "addtogroup menu".
|
2008-01-28 16:05:17 +00:00
|
|
|
*/
|