Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / pathauto / src / AliasStorageHelperInterface.php
1 <?php
2
3 namespace Drupal\pathauto;
4
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\Core\Language\LanguageInterface;
7
8 /**
9  * Provides helper methods for accessing alias storage.
10  */
11 interface AliasStorageHelperInterface {
12
13   /**
14    * Fetch the maximum length of the {url_alias}.alias field from the schema.
15    *
16    * @return int
17    *   An integer of the maximum URL alias length allowed by the database.
18    */
19   public function getAliasSchemaMaxLength();
20
21   /**
22    * Private function for Pathauto to create an alias.
23    *
24    * @param array $path
25    *   An associative array containing the following keys:
26    *   - source: The internal system path.
27    *   - alias: The URL alias.
28    *   - pid: (optional) Unique path alias identifier.
29    *   - language: (optional) The language of the alias.
30    * @param array|bool|null $existing_alias
31    *   (optional) An associative array of the existing path alias.
32    * @param string $op
33    *   An optional string with the operation being performed.
34    *
35    * @return array|bool
36    *   The saved path or NULL if the path was not saved.
37    */
38   public function save(array $path, $existing_alias = NULL, $op = NULL);
39
40   /**
41    * Fetches an existing URL alias given a path and optional language.
42    *
43    * @param string $source
44    *   An internal Drupal path.
45    * @param string $language
46    *   An optional language code to look up the path in.
47    *
48    * @return bool|array
49    *   FALSE if no alias was found or an associative array containing the
50    *   following keys:
51    *   - source (string): The internal system path with a starting slash.
52    *   - alias (string): The URL alias with a starting slash.
53    *   - pid (int): Unique path alias identifier.
54    *   - langcode (string): The language code of the alias.
55    */
56   public function loadBySource($source, $language = LanguageInterface::LANGCODE_NOT_SPECIFIED);
57
58   /**
59    * Delete all aliases by source url.
60    *
61    * @param string $source
62    *   An internal Drupal path.
63    *
64    * @return bool
65    *   The URL alias source.
66    */
67   public function deleteBySourcePrefix($source);
68
69   /**
70    * Delete all aliases (truncate the url_alias table).
71    */
72   public function deleteAll();
73
74   /**
75    * Delete an entity URL alias and any of its sub-paths.
76    *
77    * This function also checks to see if the default entity URI is different
78    * from the current entity URI and will delete any of the default aliases.
79    *
80    * @param \Drupal\Core\Entity\EntityInterface $entity
81    *   An entity object.
82    * @param string $default_uri
83    *   The optional default uri path for the entity.
84    */
85   public function deleteEntityPathAll(EntityInterface $entity, $default_uri = NULL);
86
87   /**
88    * Fetches an existing URL alias given a path prefix.
89    *
90    * @param string $source
91    *   An internal Drupal path prefix.
92    *
93    * @return integer[]
94    *   An array of PIDs.
95    */
96   public function loadBySourcePrefix($source);
97
98   /**
99    * Returns the count of url aliases for the source.
100    *
101    * @param $source
102    *   An internal Drupal path prefix.
103    *
104    * @return int
105    *   Number of url aliases for the source.
106    */
107   public function countBySourcePrefix($source);
108
109   /**
110    * Returns the total count of the url aliases.
111    *
112    * @return int
113    *   Total number of aliases.
114    */
115   public function countAll();
116
117 }