3 namespace Drupal\pathauto;
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\Core\Language\LanguageInterface;
9 * Provides helper methods for accessing alias storage.
11 interface AliasStorageHelperInterface {
14 * Fetch the maximum length of the {url_alias}.alias field from the schema.
17 * An integer of the maximum URL alias length allowed by the database.
19 public function getAliasSchemaMaxLength();
22 * Private function for Pathauto to create an alias.
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.
33 * An optional string with the operation being performed.
36 * The saved path or NULL if the path was not saved.
38 public function save(array $path, $existing_alias = NULL, $op = NULL);
41 * Fetches an existing URL alias given a path and optional language.
43 * @param string $source
44 * An internal Drupal path.
45 * @param string $language
46 * An optional language code to look up the path in.
49 * FALSE if no alias was found or an associative array containing the
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.
56 public function loadBySource($source, $language = LanguageInterface::LANGCODE_NOT_SPECIFIED);
59 * Delete all aliases by source url.
61 * @param string $source
62 * An internal Drupal path.
65 * The URL alias source.
67 public function deleteBySourcePrefix($source);
70 * Delete all aliases (truncate the url_alias table).
72 public function deleteAll();
75 * Delete an entity URL alias and any of its sub-paths.
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.
80 * @param \Drupal\Core\Entity\EntityInterface $entity
82 * @param string $default_uri
83 * The optional default uri path for the entity.
85 public function deleteEntityPathAll(EntityInterface $entity, $default_uri = NULL);
88 * Fetches an existing URL alias given a path prefix.
90 * @param string $source
91 * An internal Drupal path prefix.
96 public function loadBySourcePrefix($source);
99 * Returns the count of url aliases for the source.
102 * An internal Drupal path prefix.
105 * Number of url aliases for the source.
107 public function countBySourcePrefix($source);
110 * Returns the total count of the url aliases.
113 * Total number of aliases.
115 public function countAll();