class BookNodeIsRemovableAccessCheck

Same name in other branches
  1. 9 core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php \Drupal\book\Access\BookNodeIsRemovableAccessCheck
  2. 8.9.x core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php \Drupal\book\Access\BookNodeIsRemovableAccessCheck
  3. 10 core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php \Drupal\book\Access\BookNodeIsRemovableAccessCheck

Determines whether the requested node can be removed from its book.

Hierarchy

Expanded class hierarchy of BookNodeIsRemovableAccessCheck

1 string reference to 'BookNodeIsRemovableAccessCheck'
book.services.yml in core/modules/book/book.services.yml
core/modules/book/book.services.yml
1 service uses BookNodeIsRemovableAccessCheck
access_check.book.removable in core/modules/book/book.services.yml
Drupal\book\Access\BookNodeIsRemovableAccessCheck

File

core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php, line 13

Namespace

Drupal\book\Access
View source
class BookNodeIsRemovableAccessCheck implements AccessInterface {
    
    /**
     * Book Manager Service.
     *
     * @var \Drupal\book\BookManagerInterface
     */
    protected $bookManager;
    
    /**
     * Constructs a BookNodeIsRemovableAccessCheck object.
     *
     * @param \Drupal\book\BookManagerInterface $book_manager
     *   Book Manager Service.
     */
    public function __construct(BookManagerInterface $book_manager) {
        $this->bookManager = $book_manager;
    }
    
    /**
     * Checks access for removing the node from its book.
     *
     * @param \Drupal\node\NodeInterface $node
     *   The node requested to be removed from its book.
     *
     * @return \Drupal\Core\Access\AccessResultInterface
     *   The access result.
     */
    public function access(NodeInterface $node) {
        return AccessResult::allowedIf($this->bookManager
            ->checkNodeIsRemovable($node))
            ->addCacheableDependency($node);
    }

}

Members

Title Sort descending Modifiers Object type Summary
BookNodeIsRemovableAccessCheck::$bookManager protected property Book Manager Service.
BookNodeIsRemovableAccessCheck::access public function Checks access for removing the node from its book.
BookNodeIsRemovableAccessCheck::__construct public function Constructs a BookNodeIsRemovableAccessCheck object.

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