function hook_domain_source_path_alter in Domain Access 8
Same name and namespace in other branches
- 6.2 API.php \hook_domain_source_path_alter()
- 7.3 domain.api.php \hook_domain_source_path_alter()
- 7.2 domain.api.php \hook_domain_source_path_alter()
Allows modules to specify the target link for a Drupal path.
Note: This hook is not meant to be used for node or entity paths, which are handled by hook_domain_source_alter(). This hook is split from hook_domain_source_alter() for better performance.
Note that hook_domain_source_alter() only paths that are not content entities.
Currently, no modules in the package implement this hook.
There is no return value for this hook. Modify $source by reference by loading a valid domain record or set $source = NULL to discard an existing $source value and not rewrite the path.
Parameters
array &$source: The domain array from domain_get_node_match(), passed by reference.
string $path: The outbound path request.
array $options: The options for the url, as defined by \Drupal\Core\PathProcessor\OutboundPathProcessorInterface.
1 invocation of hook_domain_source_path_alter()
- DomainSourcePathProcessor::processOutbound in domain_source/
src/ HttpKernel/ DomainSourcePathProcessor.php - Processes the outbound path.
File
- domain_source/
domain_source.api.php, line 59 - API documentation file for Domain Source module.
Code
function hook_domain_source_path_alter(array &$source, $path, array $options) {
// Always make admin links go to the primary domain.
$parts = explode('/', $path);
if (isset($parts[0]) && $parts[0] == 'admin') {
$source = \Drupal::entityTypeManager()
->getStorage('domain')
->loadDefaultDomain();
}
}