function minisite_path_insert in Mini site 8
Implements hook_path_insert().
1 call to minisite_path_insert()
- minisite_path_update in ./
minisite.module - Implements hook_path_update().
File
- ./
minisite.module, line 104 - Main functions of the Minisite module.
Code
function minisite_path_insert($path) {
$entity = _minisite_get_entity_from_path($path['source']);
if (!$entity) {
return;
}
$path_alias = isset($path['alias']) ? $path['alias'] : '';
$minisite_fields = _minisite_get_fields($entity);
foreach ($minisite_fields as $minisite_field) {
if ($entity
->hasField($minisite_field
->getName())) {
$minisite = Minisite::createInstance($entity->{$minisite_field
->getName()});
if ($minisite) {
$minisite
->setAlias($path_alias);
$minisite
->save();
}
}
}
}