updated contrib modules : pathauto, token, entity_api, search_api, redirect, features
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
* @ingroup pathauto
|
||||
*/
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityInterface;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
@@ -82,6 +84,30 @@ function pathauto_help($route_name, RouteMatchInterface $route_match) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_insert().
|
||||
*/
|
||||
function pathauto_entity_insert(EntityInterface $entity) {
|
||||
\Drupal::service('pathauto.generator')->updateEntityAlias($entity, 'insert');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_update().
|
||||
*/
|
||||
function pathauto_entity_update(EntityInterface $entity) {
|
||||
\Drupal::service('pathauto.generator')->updateEntityAlias($entity, 'update');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_delete().
|
||||
*/
|
||||
function pathauto_entity_delete(EntityInterface $entity) {
|
||||
if ($entity->hasLinkTemplate('canonical') && $entity instanceof ContentEntityInterface && $entity->hasField('path')) {
|
||||
\Drupal::service('pathauto.alias_storage_helper')->deleteEntityPathAll($entity);
|
||||
$entity->get('path')->first()->get('pathauto')->purge();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_info_alter().
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user