Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / pathauto / pathauto.install
index f8de322f620660f1dae05ccbc426bb8ba3b637d1..4b160ba10148c1c4b1270a66f5c5ff4b61a16080 100644 (file)
@@ -8,15 +8,13 @@
  */
 
 use Drupal\Core\Entity\Entity\EntityFormDisplay;
-use Drupal\Core\Plugin\Context\Context;
-use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\pathauto\Entity\PathautoPattern;
 
 /**
  * Implements hook_install().
  */
 function pathauto_install() {
-  // Set the weight to 1
+  // Set the weight to 1.
   module_set_weight('pathauto', 1);
 
   // Ensure the url_alias table exists.
@@ -170,7 +168,8 @@ function pathauto_update_8100() {
             continue;
           }
 
-          // This is a pattern for a bundle and a language, such as "node_article_es".
+          // This is a pattern for a bundle and a language, such as
+          // "node_article_es".
           $pattern = PathautoPattern::create([
             'id' => $entity_type . '_' . $extracted_bundle . '_' . str_replace('-', '_', $langcode),
             'label' => $entity_label . ' ' . $bundle_info[$extracted_bundle]['label'] . ' ' . $language->getName(),
@@ -299,3 +298,23 @@ function pathauto_update_8106() {
   $config->set('enabled_entity_types', ['user']);
   $config->save();
 }
+
+/**
+ * Initialize the new safe tokens setting.
+ */
+function pathauto_update_8107() {
+
+  $safe_tokens = [
+    'alias',
+    'alias',
+    'path',
+    'join-path',
+    'login-url',
+    'url',
+    'url-brief',
+  ];
+
+  \Drupal::configFactory()->getEditable('pathauto.settings')
+    ->set('safe_tokens', $safe_tokens)
+    ->save();
+}