forked from drupal/drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccessDependentInterface.php
More file actions
43 lines (38 loc) · 1.42 KB
/
AccessDependentInterface.php
File metadata and controls
43 lines (38 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Drupal\Core\Access;
/**
* Interface for AccessibleInterface objects that have an access dependency.
*
* Objects should implement this interface when their access depends on access
* to another object that implements \Drupal\Core\Access\AccessibleInterface.
* This interface simply provides the getter and setter methods for the access
* dependency object. Objects that implement this interface are responsible for
* checking access of the access dependency because the dependency may not take
* effect in all cases. For instance an entity may only need the access
* dependency set when it is embedded within another entity and its access
* should be dependent on access to the entity in which it is embedded.
*
* To check the access to the dependency the object implementing this interface
* can use code like this:
* @code
* $accessible->getAccessDependency()->access($op, $account, TRUE);
* @endcode
*/
interface AccessDependentInterface {
/**
* Sets the access dependency.
*
* @param \Drupal\Core\Access\AccessibleInterface $access_dependency
* The object upon which access depends.
*
* @return $this
*/
public function setAccessDependency(AccessibleInterface $access_dependency);
/**
* Gets the access dependency.
*
* @return \Drupal\Core\Access\AccessibleInterface|null
* The access dependency or NULL if none has been set.
*/
public function getAccessDependency();
}