class DeleteLinkAccessCheck

Access check for menu link delete routes.

Hierarchy

Expanded class hierarchy of DeleteLinkAccessCheck

1 string reference to 'DeleteLinkAccessCheck'
menu.services.yml in drupal/core/modules/menu/menu.services.yml
drupal/core/modules/menu/menu.services.yml
1 service uses DeleteLinkAccessCheck

File

drupal/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php, line 17
Contains \Drupal\menu\Access\DeleteLinkAccessCheck.

Namespace

Drupal\menu\Access
View source
class DeleteLinkAccessCheck implements AccessCheckInterface {

  /**
   * {@inheritdoc}
   */
  public function applies(Route $route) {
    return array_key_exists('_access_menu_delete_link', $route
      ->getRequirements());
  }

  /**
   * {@inheritdoc}
   */
  public function access(Route $route, Request $request) {
    if (user_access('administer menu') && ($menu_link = $request->attributes
      ->get('menu_link'))) {

      // Links defined via hook_menu may not be deleted. Updated items are an
      // exception, as they can be broken.
      return $menu_link->module !== 'system' || $menu_link->updated;
    }
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AccessCheckInterface::ALLOW constant Grant access.
AccessCheckInterface::DENY constant Deny access.
AccessCheckInterface::KILL constant Block access.
DeleteLinkAccessCheck::access public function Checks for access to route. Overrides AccessCheckInterface::access
DeleteLinkAccessCheck::applies public function Declares whether the access check applies to a specific route or not. Overrides AccessCheckInterface::applies