Drupal 8  8.0.2
AliasStorage Class Reference
Inheritance diagram for AliasStorage:

Public Member Functions

 __construct (Connection $connection, ModuleHandlerInterface $module_handler)
 
 save ($source, $alias, $langcode=LanguageInterface::LANGCODE_NOT_SPECIFIED, $pid=NULL)
 
 load ($conditions)
 
 delete ($conditions)
 
 preloadPathAlias ($preloaded, $langcode)
 
 lookupPathAlias ($path, $langcode)
 
 lookupPathSource ($path, $langcode)
 
 aliasExists ($alias, $langcode, $source=NULL)
 
 languageAliasExists ()
 
 getAliasesForAdminListing ($header, $keys=NULL)
 
 pathHasMatchingAlias ($initial_substring)
 

Protected Attributes

 $connection
 
 $moduleHandler
 

Detailed Description

Provides a class for CRUD operations on path aliases.

All queries perform case-insensitive matching on the 'source' and 'alias' fields, so the aliases '/test-alias' and '/test-Alias' are considered to be the same, and will both refer to the same internal system path.

Constructor & Destructor Documentation

__construct ( Connection  $connection,
ModuleHandlerInterface  $module_handler 
)

Constructs a Path CRUD object.

Parameters
\Drupal\Core\Database\Connection$connectionA database connection for reading and writing path aliases.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.

References Drupal\moduleHandler().

Here is the call graph for this function:

Member Function Documentation

aliasExists (   $alias,
  $langcode,
  $source = NULL 
)

{Checks if alias already exists.The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.

Parameters
string$aliasAlias to check against.
string$langcodeLanguage of the alias.
string | null$source(optional) Path that alias is to be assigned to.
Returns
bool TRUE if alias already exists and FALSE otherwise.
}

Implements AliasStorageInterface.

delete (   $conditions)

{Deletes a URL alias.The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.

Parameters
array$conditionsAn array of criteria.
}

Implements AliasStorageInterface.

References Cache\invalidateTags(), AliasStorage\load(), and Drupal\moduleHandler().

Here is the call graph for this function:

getAliasesForAdminListing (   $header,
  $keys = NULL 
)

{Loads aliases for admin listing.

Parameters
array$headerTable header.
string | null$keys(optional) Search keyword that may include one or more '*' as wildcard values.
Returns
array Array of items to be displayed on the current page.
}

Implements AliasStorageInterface.

languageAliasExists ( )

{Checks if there are any aliases with language defined.

Returns
bool TRUE if aliases with language exist.
}

Implements AliasStorageInterface.

References LanguageInterface\LANGCODE_NOT_SPECIFIED.

load (   $conditions)

{Fetches a specific URL alias from the database.The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.

Parameters
array$conditionsAn array of query conditions.
Returns
array|false FALSE if no alias was found or an associative array containing the following keys:
  • source (string): The internal system path with a starting slash.
  • alias (string): The URL alias with a starting slash.
  • pid (int): Unique path alias identifier.
  • langcode (string): The language code of the alias.
}

Implements AliasStorageInterface.

Referenced by AliasStorage\delete().

Here is the caller graph for this function:

lookupPathAlias (   $path,
  $langcode 
)

{Returns an alias of Drupal system URL.The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.

Parameters
string$pathThe path to investigate for corresponding path aliases.
string$langcodeLanguage code to search the path with. If there's no path defined for that language it will search paths without language.
Returns
string|false A path alias, or FALSE if no path was found.
}

Implements AliasStorageInterface.

References LanguageInterface\LANGCODE_NOT_SPECIFIED.

lookupPathSource (   $path,
  $langcode 
)

{Returns Drupal system URL of an alias.The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.

Parameters
string$pathThe path to investigate for corresponding system URLs.
string$langcodeLanguage code to search the path with. If there's no path defined for that language it will search paths without language.
Returns
string|false A Drupal system path, or FALSE if no path was found.
}

Implements AliasStorageInterface.

References LanguageInterface\LANGCODE_NOT_SPECIFIED.

pathHasMatchingAlias (   $initial_substring)

{Check if any alias exists starting with $initial_substring.

Parameters
string$initial_substringInitial path substring to test against.
Returns
bool TRUE if any alias exists, FALSE otherwise.
}

Implements AliasStorageInterface.

preloadPathAlias (   $preloaded,
  $langcode 
)

{Pre-loads path alias information for a given list of source paths.

Parameters
array$preloadedPaths that need preloading of aliases.
string$langcodeLanguage code to search the path with. If there's no path defined for that language it will search paths without language.
Returns
string[] Source (keys) to alias (values) mapping.
}

Implements AliasStorageInterface.

References LanguageInterface\LANGCODE_NOT_SPECIFIED.

save (   $source,
  $alias,
  $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED,
  $pid = NULL 
)

{Saves a path alias to the database.

Parameters
string$sourceThe internal system path.
string$aliasThe URL alias.
string$langcode(optional) The language code of the alias.
int | null$pid(optional) Unique path alias identifier.
Returns
array|false FALSE if the path could not be saved or an associative array containing the following keys:
  • source (string): The internal system path with a starting slash.
  • alias (string): The URL alias with a starting slash.
  • pid (int): Unique path alias identifier.
  • langcode (string): The language code of the alias.
  • original: For updates, an array with source, alias and langcode with the previous values.

Thrown when either the source or alias has not a starting slash.}

Implements AliasStorageInterface.

References Cache\invalidateTags(), and Drupal\moduleHandler().

Here is the call graph for this function:


The documentation for this class was generated from the following file: