Chris@17
|
1 <?php
|
Chris@17
|
2
|
Chris@17
|
3 namespace Drupal\block_content\Event;
|
Chris@17
|
4
|
Chris@17
|
5 use Drupal\block_content\BlockContentInterface;
|
Chris@17
|
6 use Drupal\Core\Access\AccessibleInterface;
|
Chris@17
|
7 use Symfony\Component\EventDispatcher\Event;
|
Chris@17
|
8
|
Chris@17
|
9 /**
|
Chris@17
|
10 * Block content event to allow setting an access dependency.
|
Chris@17
|
11 *
|
Chris@17
|
12 * @internal
|
Chris@17
|
13 */
|
Chris@17
|
14 class BlockContentGetDependencyEvent extends Event {
|
Chris@17
|
15
|
Chris@17
|
16 /**
|
Chris@17
|
17 * The block content entity.
|
Chris@17
|
18 *
|
Chris@17
|
19 * @var \Drupal\block_content\BlockContentInterface
|
Chris@17
|
20 */
|
Chris@17
|
21 protected $blockContent;
|
Chris@17
|
22
|
Chris@17
|
23 /**
|
Chris@17
|
24 * The dependency.
|
Chris@17
|
25 *
|
Chris@17
|
26 * @var \Drupal\Core\Access\AccessibleInterface
|
Chris@17
|
27 */
|
Chris@17
|
28 protected $accessDependency;
|
Chris@17
|
29
|
Chris@17
|
30 /**
|
Chris@17
|
31 * BlockContentGetDependencyEvent constructor.
|
Chris@17
|
32 *
|
Chris@17
|
33 * @param \Drupal\block_content\BlockContentInterface $blockContent
|
Chris@17
|
34 * The block content entity.
|
Chris@17
|
35 */
|
Chris@17
|
36 public function __construct(BlockContentInterface $blockContent) {
|
Chris@17
|
37 $this->blockContent = $blockContent;
|
Chris@17
|
38 }
|
Chris@17
|
39
|
Chris@17
|
40 /**
|
Chris@17
|
41 * Gets the block content entity.
|
Chris@17
|
42 *
|
Chris@17
|
43 * @return \Drupal\block_content\BlockContentInterface
|
Chris@17
|
44 * The block content entity.
|
Chris@17
|
45 */
|
Chris@17
|
46 public function getBlockContentEntity() {
|
Chris@17
|
47 return $this->blockContent;
|
Chris@17
|
48 }
|
Chris@17
|
49
|
Chris@17
|
50 /**
|
Chris@17
|
51 * Gets the access dependency.
|
Chris@17
|
52 *
|
Chris@17
|
53 * @return \Drupal\Core\Access\AccessibleInterface
|
Chris@17
|
54 * The access dependency.
|
Chris@17
|
55 */
|
Chris@17
|
56 public function getAccessDependency() {
|
Chris@17
|
57 return $this->accessDependency;
|
Chris@17
|
58 }
|
Chris@17
|
59
|
Chris@17
|
60 /**
|
Chris@17
|
61 * Sets the access dependency.
|
Chris@17
|
62 *
|
Chris@17
|
63 * @param \Drupal\Core\Access\AccessibleInterface $access_dependency
|
Chris@17
|
64 * The access dependency.
|
Chris@17
|
65 */
|
Chris@17
|
66 public function setAccessDependency(AccessibleInterface $access_dependency) {
|
Chris@17
|
67 $this->accessDependency = $access_dependency;
|
Chris@17
|
68 }
|
Chris@17
|
69
|
Chris@17
|
70 }
|