Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / pathauto / src / PathautoPatternInterface.php
1 <?php
2
3 namespace Drupal\pathauto;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6
7 /**
8  * Provides an interface for defining Pathauto pattern entities.
9  */
10 interface PathautoPatternInterface extends ConfigEntityInterface {
11
12   /**
13    * Get the tokenized pattern used during alias generation.
14    *
15    * @return string
16    */
17   public function getPattern();
18
19   /**
20    * Set the tokenized pattern to use during alias generation.
21    *
22    * @param string $pattern
23    *
24    * @return $this
25    */
26   public function setPattern($pattern);
27
28   /**
29    * Gets the type of this pattern.
30    *
31    * @return string
32    */
33   public function getType();
34
35   /**
36    * @return \Drupal\pathauto\AliasTypeInterface
37    */
38   public function getAliasType();
39
40   /**
41    * Gets the weight of this pattern (compared to other patterns of this type).
42    *
43    * @return int
44    */
45   public function getWeight();
46
47   /**
48    * Sets the weight of this pattern (compared to other patterns of this type).
49    *
50    * @param int $weight
51    *   The weight of the variant.
52    *
53    * @return $this
54    */
55   public function setWeight($weight);
56
57   /**
58    * Returns the contexts of this pattern.
59    *
60    * @return \Drupal\Core\Plugin\Context\ContextInterface[]
61    */
62   public function getContexts();
63
64   /**
65    * Returns whether a relationship exists.
66    *
67    * @param string $token
68    *   Relationship identifier.
69    *
70    * @return bool
71    *   TRUE if the relationship exists, FALSE otherwise.
72    */
73   public function hasRelationship($token);
74
75   /**
76    * Adds a relationship.
77    *
78    * The relationship will not be changed if it already exists.
79    *
80    * @param string $token
81    *   Relationship identifier.
82    * @param string|null $label
83    *   (optional) A label, will use the label of the referenced context if not
84    *   provided.
85    *
86    * @return $this
87    */
88   public function addRelationship($token, $label = NULL);
89
90   /**
91    * Replaces a relationship.
92    *
93    * Only already existing relationships are updated.
94    *
95    * @param string $token
96    *   Relationship identifier.
97    * @param string|null $label
98    *   (optional) A label, will use the label of the referenced context if not
99    *   provided.
100    *
101    * @return $this
102    */
103   public function replaceRelationship($token, $label);
104
105   /**
106    * Removes a relationship.
107    *
108    * @param string $token
109    *   Relationship identifier.
110    *
111    * @return $this
112    */
113   public function removeRelationship($token);
114
115   /**
116    * Returns a list of relationships.
117    *
118    * @return array[]
119    *   Keys are context tokens, and values are arrays with the following keys:
120    *   - label (string|null, optional): The human-readable label of this
121    *     relationship.
122    */
123   public function getRelationships();
124
125   /**
126    * Gets the selection condition collection.
127    *
128    * @return \Drupal\Core\Condition\ConditionInterface[]|\Drupal\Core\Condition\ConditionPluginCollection
129    */
130   public function getSelectionConditions();
131
132   /**
133    * Adds selection criteria.
134    *
135    * @param array $configuration
136    *   Configuration of the selection criteria.
137    *
138    * @return string
139    *   The condition id of the new criteria.
140    */
141   public function addSelectionCondition(array $configuration);
142
143   /**
144    * Gets selection criteria by condition id.
145    *
146    * @param string $condition_id
147    *   The id of the condition.
148    *
149    * @return \Drupal\Core\Condition\ConditionInterface
150    */
151   public function getSelectionCondition($condition_id);
152
153   /**
154    * Removes selection criteria by condition id.
155    *
156    * @param string $condition_id
157    *   The id of the condition.
158    *
159    * @return $this
160    */
161   public function removeSelectionCondition($condition_id);
162
163   /**
164    * Gets the selection logic used by the criteria (ie. "and" or "or").
165    *
166    * @return string
167    *   Either "and" or "or"; represents how the selection criteria are combined.
168    */
169   public function getSelectionLogic();
170
171   /**
172    * Determines if this pattern can apply a given object.
173    *
174    * @param $object
175    *   The object used to determine if this plugin can apply.
176    *
177    * @return bool
178    */
179   public function applies($object);
180
181 }