Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Menu/menu.api.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
199 * $tree = $menu_tree->transform($tree, $manipulators); | 199 * $tree = $menu_tree->transform($tree, $manipulators); |
200 * | 200 * |
201 * // Finally, build a renderable array from the transformed tree. | 201 * // Finally, build a renderable array from the transformed tree. |
202 * $menu = $menu_tree->build($tree); | 202 * $menu = $menu_tree->build($tree); |
203 * | 203 * |
204 * $menu_html = drupal_render($menu); | 204 * $menu_html = \Drupal::service('renderer')->render($menu); |
205 * @endcode | 205 * @endcode |
206 * | 206 * |
207 * @} | 207 * @} |
208 */ | 208 */ |
209 | 209 |
300 * An associative array containing list of (up to 2) tab levels that contain a | 300 * An associative array containing list of (up to 2) tab levels that contain a |
301 * list of tabs keyed by their href, each one being an associative array | 301 * list of tabs keyed by their href, each one being an associative array |
302 * as described above. | 302 * as described above. |
303 * @param string $route_name | 303 * @param string $route_name |
304 * The route name of the page. | 304 * The route name of the page. |
305 * | 305 * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability |
306 * @ingroup menu | 306 * The cacheability metadata for the current route's local tasks. |
307 */ | 307 * |
308 function hook_menu_local_tasks_alter(&$data, $route_name) { | 308 * @ingroup menu |
309 */ | |
310 function hook_menu_local_tasks_alter(&$data, $route_name, \Drupal\Core\Cache\RefinableCacheableDependencyInterface &$cacheability) { | |
309 | 311 |
310 // Add a tab linking to node/add to all pages. | 312 // Add a tab linking to node/add to all pages. |
311 $data['tabs'][0]['node.add_page'] = [ | 313 $data['tabs'][0]['node.add_page'] = [ |
312 '#theme' => 'menu_local_task', | 314 '#theme' => 'menu_local_task', |
313 '#link' => [ | 315 '#link' => [ |
318 'title' => t('Add content'), | 320 'title' => t('Add content'), |
319 ], | 321 ], |
320 ], | 322 ], |
321 ], | 323 ], |
322 ]; | 324 ]; |
325 // The tab we're adding is dependent on a user's access to add content. | |
326 $cacheability->addCacheTags(['user.permissions']); | |
323 } | 327 } |
324 | 328 |
325 /** | 329 /** |
326 * Alter local actions plugins. | 330 * Alter local actions plugins. |
327 * | 331 * |