Commit 7fa83872 authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #3265632: Fix Errors for messing Enabled entity types and Safe tokens on...

Issue #3265632: Fix Errors for messing Enabled entity types and Safe tokens on the URL aliases settings page
parent 489cdbcc
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -115,7 +115,9 @@ function varbase_seo_install() {
}

/**
 * Issue #3265632: Fix Errors on Pathauto's settings page.
 * Issue #3265632: Fix Errors for messing Enabled entity types and Safe tokens.
 *
 * On the URL aliases settings page.
 */
function varbase_seo_update_90001() {

@@ -123,17 +125,15 @@ function varbase_seo_update_90001() {
  $pathauto_settings = \Drupal::service('config.factory')->getEditable('pathauto.settings');

  // Add enable entity types if it was notin the pathauto settings in the active site configs.
  $enabled_entity_types = $$pathauto_settings->get('enabled_entity_types');
  $enabled_entity_types = $pathauto_settings->get('enabled_entity_types');
  if (isset($enabled_entity_types)
    && is_array($enabled_entity_types)
    && !(count($enabled_entity_types) > 0)) {

    $enabled_entity_types = ['user'];
    $pathauto_settings->set('enabled_entity_types', $enabled_entity_types)->save(TRUE);
    $pathauto_settings->set('enabled_entity_types', ['user'])->save(TRUE);
  }

  // Add the list of safe tokens if it was not in the pathauto settings in the active site configs.
  $safe_tokens = $$pathauto_settings->get('safe_tokens');
  $safe_tokens = $pathauto_settings->get('safe_tokens');
  if (isset($safe_tokens)
    && is_array($safe_tokens)
    && !(count($safe_tokens) > 0)) {