function NavigationContentLinks::removeAdminContentLink

Same name in other branches
  1. 10 core/modules/navigation/src/NavigationContentLinks.php \Drupal\navigation\NavigationContentLinks::removeAdminContentLink()

Remove the admin/content link, and any direct children.

Parameters

array $links: The array of links being altered.

File

core/modules/navigation/src/NavigationContentLinks.php, line 103

Class

NavigationContentLinks
Build the menu links for the Content menu.

Namespace

Drupal\navigation

Code

public function removeAdminContentLink(array &$links) : void {
    unset($links['system.admin_content']);
    // Also remove any links that have set admin/content as their parent link.
    // They are unsupported by the Navigation module.
    foreach ($links as $link_name => $link) {
        if (isset($link['parent']) && $link['parent'] === 'system.admin_content') {
            // @todo Do we need to make this recursive, and unset children of these
            // links too?
            unset($links[$link_name]);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.