Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Menu / menu.api.php
index f932cf9bc4b618184e59738f2fd4034493ac2e32..42e11867e37b6eefed0070c37c7358591b266153 100644 (file)
  * // Finally, build a renderable array from the transformed tree.
  * $menu = $menu_tree->build($tree);
  *
- * $menu_html = drupal_render($menu);
+ * $menu_html = \Drupal::service('renderer')->render($menu);
  * @endcode
  *
  * @}
@@ -302,10 +302,12 @@ function hook_menu_links_discovered_alter(&$links) {
  *   as described above.
  * @param string $route_name
  *   The route name of the page.
+ * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability
+ *   The cacheability metadata for the current route's local tasks.
  *
  * @ingroup menu
  */
-function hook_menu_local_tasks_alter(&$data, $route_name) {
+function hook_menu_local_tasks_alter(&$data, $route_name, \Drupal\Core\Cache\RefinableCacheableDependencyInterface &$cacheability) {
 
   // Add a tab linking to node/add to all pages.
   $data['tabs'][0]['node.add_page'] = [
@@ -320,6 +322,8 @@ function hook_menu_local_tasks_alter(&$data, $route_name) {
           ],
       ],
   ];
+  // The tab we're adding is dependent on a user's access to add content.
+  $cacheability->addCacheTags(['user.permissions']);
 }
 
 /**
@@ -446,7 +450,7 @@ function hook_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &$bread
  *   The following keys can be altered:
  *   - text: The link text for the anchor tag. If the hook implementation
  *     changes this text it needs to preserve the safeness of the original text.
- *     Using t() or \Drupal\Component\Utility\SafeMarkup::format() with
+ *     Using t() or \Drupal\Component\Render\FormattableMarkup with
  *     @placeholder is recommended as this will escape the original text if
  *     necessary. If the resulting text is not marked safe it will be escaped.
  *   - url_is_active: Whether or not the link points to the currently active