Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / pathauto / pathauto.module
index d0763fa176337c3b1810c0010911c3746279be27..67b3359ee5871e321fa8214a169f5cfd85b5bf37 100644 (file)
@@ -25,7 +25,8 @@ use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Url;
-use Drupal\pathauto\PathautoState;
+use Drupal\pathauto\PathautoFieldItemList;
+use Drupal\pathauto\PathautoItem;
 
 /**
  * The default ignore word list.
@@ -103,7 +104,7 @@ function pathauto_entity_update(EntityInterface $entity) {
 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->path->first()->get('pathauto')->purge();
+    $entity->get('path')->first()->get('pathauto')->purge();
   }
 }
 
@@ -111,7 +112,8 @@ function pathauto_entity_delete(EntityInterface $entity) {
  * Implements hook_field_info_alter().
  */
 function pathauto_field_info_alter(&$info) {
-  $info['path']['class'] = '\Drupal\pathauto\PathautoItem';
+  $info['path']['class'] = PathautoItem::class;
+  $info['path']['list_class'] = PathautoFieldItemList::class;
 }
 
 /**
@@ -146,17 +148,6 @@ function pathauto_entity_base_field_info(EntityTypeInterface $entity_type) {
   }
 }
 
-/**
- * Implements hook_entity_base_field_info_alter().
- */
-function pathauto_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) {
-  if (isset($fields['path'])) {
-    // Path fields need to be computed so that the pathauto state can be
-    // accessed even if there is no alias being set.
-    $fields['path']->setComputed(TRUE);
-  }
-}
-
 /**
  * Validate the pattern field, to ensure it doesn't contain any characters that
  * are invalid in URLs.