Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 4 |
| BookNodeIsRemovableAccessCheck | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 4 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| access | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\book\Access\BookNodeIsRemovableAccessCheck. | |
| */ | |
| namespace Drupal\book\Access; | |
| use Drupal\book\BookManagerInterface; | |
| use Drupal\Core\Access\AccessResult; | |
| use Drupal\Core\Routing\Access\AccessInterface; | |
| use Drupal\node\NodeInterface; | |
| /** | |
| * Determines whether the requested node can be removed from its book. | |
| */ | |
| 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))->cacheUntilEntityChanges($node); | |
| } | |
| } |