3 namespace Drupal\pathauto;
4 use Drupal\Core\Entity\EntityInterface;
5 use Drupal\Core\Language\LanguageInterface;
8 * Provides helper methods for accessing alias storage.
10 interface AliasStorageHelperInterface {
13 * Fetch the maximum length of the {url_alias}.alias field from the schema.
16 * An integer of the maximum URL alias length allowed by the database.
18 public function getAliasSchemaMaxLength();
21 * Private function for Pathauto to create an alias.
24 * An associative array containing the following keys:
25 * - source: The internal system path.
26 * - alias: The URL alias.
27 * - pid: (optional) Unique path alias identifier.
28 * - language: (optional) The language of the alias.
29 * @param array|bool|null $existing_alias
30 * (optional) An associative array of the existing path alias.
32 * An optional string with the operation being performed.
35 * The saved path or NULL if the path was not saved.
37 public function save(array $path, $existing_alias = NULL, $op = NULL);
40 * Fetches an existing URL alias given a path and optional language.
42 * @param string $source
43 * An internal Drupal path.
44 * @param string $language
45 * An optional language code to look up the path in.
48 * FALSE if no alias was found or an associative array containing the
50 * - source (string): The internal system path with a starting slash.
51 * - alias (string): The URL alias with a starting slash.
52 * - pid (int): Unique path alias identifier.
53 * - langcode (string): The language code of the alias.
55 public function loadBySource($source, $language = LanguageInterface::LANGCODE_NOT_SPECIFIED);
58 * Delete all aliases by source url.
60 * @param string $source
61 * An internal Drupal path.
64 * The URL alias source.
66 public function deleteBySourcePrefix($source);
69 * Delete all aliases (truncate the url_alias table).
71 public function deleteAll();
74 * Delete an entity URL alias and any of its sub-paths.
76 * This function also checks to see if the default entity URI is different
77 * from the current entity URI and will delete any of the default aliases.
79 * @param \Drupal\Core\Entity\EntityInterface $entity
81 * @param string $default_uri
82 * The optional default uri path for the entity.
84 public function deleteEntityPathAll(EntityInterface $entity, $default_uri = NULL);
87 * Fetches an existing URL alias given a path prefix.
89 * @param string $source
90 * An internal Drupal path prefix.
95 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();