Version 1
[yaffs-website] / web / modules / contrib / pathauto / src / PathautoGeneratorInterface.php
1 <?php
2
3 namespace Drupal\pathauto;
4
5 use Drupal\Core\Entity\EntityInterface;
6
7 /**
8  * Provides and interface for PathautoGenerator.
9  */
10 interface PathautoGeneratorInterface {
11
12   /**
13    * "Do nothing. Leave the old alias intact."
14    */
15   const UPDATE_ACTION_NO_NEW = 0;
16
17   /**
18    * "Create a new alias. Leave the existing alias functioning."
19    */
20   const UPDATE_ACTION_LEAVE = 1;
21
22   /**
23    * "Create a new alias. Delete the old alias."
24    */
25   const UPDATE_ACTION_DELETE = 2;
26
27   /**
28    * Remove the punctuation from the alias.
29    */
30   const PUNCTUATION_REMOVE = 0;
31
32   /**
33    * Replace the punctuation with the separator in the alias.
34    */
35   const PUNCTUATION_REPLACE = 1;
36
37   /**
38    * Leave the punctuation as it is in the alias.
39    */
40   const PUNCTUATION_DO_NOTHING = 2;
41
42   /**
43    * Resets internal caches.
44    */
45   public function resetCaches();
46
47   /**
48    * Load an alias pattern entity by entity, bundle, and language.
49    *
50    * @param \Drupal\Core\Entity\EntityInterface $entity
51    *   An entity.
52    * @return \Drupal\pathauto\PathautoPatternInterface|null
53    */
54   public function getPatternByEntity(EntityInterface $entity);
55
56   /**
57    * Apply patterns to create an alias.
58    *
59    * @param \Drupal\Core\Entity\EntityInterface $entity
60    *   The entity.
61    * @param string $op
62    *   Operation being performed on the content being aliased
63    *   ('insert', 'update', 'return', or 'bulkupdate').
64    *
65    * @return array|string
66    *   The alias that was created.
67    *
68    * @see _pathauto_set_alias()
69    */
70   public function createEntityAlias(EntityInterface $entity, $op);
71
72   /**
73    * Creates or updates an alias for the given entity.
74    *
75    * @param EntityInterface $entity
76    *   Entity for which to update the alias.
77    * @param string $op
78    *   The operation performed (insert, update)
79    * @param array $options
80    *   - force: will force updating the path
81    *   - language: the language for which to create the alias
82    *
83    * @return array|null
84    *   - An array with alias data in case the alias has been created or updated.
85    *   - NULL if no operation performed.
86    */
87   public function updateEntityAlias(EntityInterface $entity, $op, array $options = array());
88
89 }