3 namespace Drupal\pathauto;
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
8 * Provides an interface for defining Pathauto pattern entities.
10 interface PathautoPatternInterface extends ConfigEntityInterface {
13 * Get the tokenized pattern used during alias generation.
17 public function getPattern();
20 * Set the tokenized pattern to use during alias generation.
22 * @param string $pattern
26 public function setPattern($pattern);
29 * Gets the type of this pattern.
33 public function getType();
36 * @return \Drupal\pathauto\AliasTypeInterface
38 public function getAliasType();
41 * Gets the weight of this pattern (compared to other patterns of this type).
45 public function getWeight();
48 * Sets the weight of this pattern (compared to other patterns of this type).
51 * The weight of the variant.
55 public function setWeight($weight);
58 * Returns the contexts of this pattern.
60 * @return \Drupal\Core\Plugin\Context\ContextInterface[]
62 public function getContexts();
65 * Returns whether a relationship exists.
67 * @param string $token
68 * Relationship identifier.
71 * TRUE if the relationship exists, FALSE otherwise.
73 public function hasRelationship($token);
76 * Adds a relationship.
78 * The relationship will not be changed if it already exists.
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
88 public function addRelationship($token, $label = NULL);
91 * Replaces a relationship.
93 * Only already existing relationships are updated.
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
103 public function replaceRelationship($token, $label);
106 * Removes a relationship.
108 * @param string $token
109 * Relationship identifier.
113 public function removeRelationship($token);
116 * Returns a list of relationships.
119 * Keys are context tokens, and values are arrays with the following keys:
120 * - label (string|null, optional): The human-readable label of this
123 public function getRelationships();
126 * Gets the selection condition collection.
128 * @return \Drupal\Core\Condition\ConditionInterface[]|\Drupal\Core\Condition\ConditionPluginCollection
130 public function getSelectionConditions();
133 * Adds selection criteria.
135 * @param array $configuration
136 * Configuration of the selection criteria.
139 * The condition id of the new criteria.
141 public function addSelectionCondition(array $configuration);
144 * Gets selection criteria by condition id.
146 * @param string $condition_id
147 * The id of the condition.
149 * @return \Drupal\Core\Condition\ConditionInterface
151 public function getSelectionCondition($condition_id);
154 * Removes selection criteria by condition id.
156 * @param string $condition_id
157 * The id of the condition.
161 public function removeSelectionCondition($condition_id);
164 * Gets the selection logic used by the criteria (ie. "and" or "or").
167 * Either "and" or "or"; represents how the selection criteria are combined.
169 public function getSelectionLogic();
172 * Determines if this pattern can apply a given object.
175 * The object used to determine if this plugin can apply.
179 public function applies($object);