-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathContextDefinitionInterface.php
More file actions
90 lines (78 loc) · 2.35 KB
/
ContextDefinitionInterface.php
File metadata and controls
90 lines (78 loc) · 2.35 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
namespace Drupal\rules\Context;
use \Drupal\Core\Plugin\Context\ContextDefinitionInterface as ContextDefinitionInterfaceCore;
/**
* Context definition information required by Rules.
*
* The core interface is extended to add properties that are necessary for
* Rules.
*/
interface ContextDefinitionInterface extends ContextDefinitionInterfaceCore {
/**
* Constants for the context assignment restriction mode.
*
* @see ::getAssignmentRestriction()
*/
const ASSIGNMENT_RESTRICTION_INPUT = 'input';
const ASSIGNMENT_RESTRICTION_SELECTOR = 'selector';
/**
* Determines if the context value is allowed to be NULL.
*
* @return bool
* TRUE if NULL values are allowed, FALSE otherwise.
*/
public function isAllowedNull();
/**
* Sets the "allow NULL value" behavior.
*
* @param bool $null_allowed
* TRUE if NULL values should be allowed, FALSE otherwise.
*
* @return $this
*/
public function setAllowNull($null_allowed);
/**
* Determines if this context has an assignment restriction.
*
* @return string|null
* Either ASSIGNMENT_RESTRICTION_INPUT for contexts that are only allowed to
* be provided as input values, ASSIGNMENT_RESTRICTION_SELECTOR for contexts
* that must be provided as data selectors or NULL if there is no
* restriction for this context.
*/
public function getAssignmentRestriction();
/**
* Sets the assignment restriction mode for this context.
*
* @param string|null $restriction
* Either ASSIGNMENT_RESTRICTION_INPUT for contexts that are only allowed to
* be provided as input values, ASSIGNMENT_RESTRICTION_SELECTOR for contexts
* that must be provided as data selectors or NULL if there is no
* restriction for this context.
*/
public function setAssignmentRestriction($restriction);
/**
* Determines form element for the context type
* e.g textarea.
*
* @return string
* Type of form element to be used.
*/
public function getFormElement();
/**
* Sets the form element for context.
*
* @param string $form_element
* Type of form element to be used.
*
* @return $this
*/
public function setFormElement($form_element);
/**
* Exports the definition as an array.
*
* @return array
* An array with values for all definition keys.
*/
public function toArray();
}