Skip to content
Snippets Groups Projects
Select Git revision
  • b8f93d5b610cc5c6ba36d69bd8c1ec3b30ff7b25
  • 11.x default protected
  • 10.5.x protected
  • 10.6.x protected
  • 11.2.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

InaccessibleMenuLink.php

Blame
  • Alex Pott's avatar
    Issue #2901730 by mfernea, ankitjain28may, idebr: Fix...
    Alex Pott authored
    Issue #2901730 by mfernea, ankitjain28may, idebr: Fix 'Squiz.WhiteSpace.FunctionSpacing' coding standard
    b8f93d5b
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    InaccessibleMenuLink.php 1.65 KiB
    <?php
    
    namespace Drupal\Core\Menu;
    
    use Drupal\Component\Plugin\Exception\PluginException;
    
    /**
     * A menu link plugin for wrapping another menu link, in sensitive situations.
     *
     * @see \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators::checkAccess()
     */
    class InaccessibleMenuLink extends MenuLinkBase {
    
      /**
       * The wrapped menu link.
       *
       * @var \Drupal\Core\Menu\MenuLinkInterface
       */
      protected $wrappedLink;
    
      /**
       * Constructs a new InaccessibleMenuLink.
       *
       * @param \Drupal\Core\Menu\MenuLinkInterface $wrapped_link
       *   The menu link to wrap.
       */
      public function __construct(MenuLinkInterface $wrapped_link) {
        $this->wrappedLink = $wrapped_link;
        $plugin_definition = [
          'route_name' => '<front>',
          'route_parameters' => [],
          'url' => NULL,
        ] + $this->wrappedLink->getPluginDefinition();
        parent::__construct([], $this->wrappedLink->getPluginId(), $plugin_definition);
      }
    
      /**
       * {@inheritdoc}
       */
      public function getTitle() {
        return $this->t('Inaccessible');
      }
    
      /**
       * {@inheritdoc}
       */
      public function getDescription() {
        return '';
      }
    
      /**
       * {@inheritdoc}
       */
      public function getCacheContexts() {
        return $this->wrappedLink->getCacheContexts();
      }
    
      /**
       * {@inheritdoc}
       */
      public function getCacheTags() {
        return $this->wrappedLink->getCacheTags();
      }
    
      /**
       * {@inheritdoc}
       */
      public function getCacheMaxAge() {
        return $this->wrappedLink->getCacheMaxAge();
      }
    
      /**
       * {@inheritdoc}
       */
      public function updateLink(array $new_definition_values, $persist) {
        throw new PluginException('Inaccessible menu link plugins do not support updating');
      }
    
    }