class BookNodeIsRemovableAccessCheck
Same name in other branches
- 9 core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php \Drupal\book\Access\BookNodeIsRemovableAccessCheck
- 8.9.x core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php \Drupal\book\Access\BookNodeIsRemovableAccessCheck
- 11.x core/modules/book/src/Access/BookNodeIsRemovableAccessCheck.php \Drupal\book\Access\BookNodeIsRemovableAccessCheck
Determines whether the requested node can be removed from its book.
Hierarchy
- class \Drupal\book\Access\BookNodeIsRemovableAccessCheck implements \Drupal\Core\Routing\Access\AccessInterface
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
File
-
core/
modules/ book/ src/ Access/ BookNodeIsRemovableAccessCheck.php, line 13
Namespace
Drupal\book\AccessView 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.