diff --git a/migrations/pathauto_settings.yml b/migrations/pathauto_settings.yml index d99c3a6..c336ac5 100644 --- a/migrations/pathauto_settings.yml +++ b/migrations/pathauto_settings.yml @@ -49,7 +49,38 @@ source: - pathauto_update_action source_module: pathauto process: - punctuation: punctuation + punctuation/ampersand: pathauto_punctuation_ampersand + punctuation/asterisk: pathauto_punctuation_asterisk + punctuation/at: pathauto_punctuation_at + punctuation/backtick: pathauto_punctuation_backtick + punctuation/back_slash: pathauto_punctuation_back_slash + punctuation/caret: pathauto_punctuation_caret + punctuation/colon: pathauto_punctuation_colon + punctuation/comma: pathauto_punctuation_comma + punctuation/dollar: pathauto_punctuation_dollar + punctuation/double_quotes: pathauto_punctuation_double_quotes + punctuation/equal: pathauto_punctuation_equal + punctuation/exclamation: pathauto_punctuation_exclamation + punctuation/greater_than: pathauto_punctuation_greater_than + punctuation/hash: pathauto_punctuation_hash + punctuation/hyphen: pathauto_punctuation_hyphen + punctuation/left_curly: pathauto_punctuation_left_curly + punctuation/left_parenthesis: pathauto_punctuation_left_parenthesis + punctuation/left_square: pathauto_punctuation_left_square + punctuation/less_than: pathauto_punctuation_less_than + punctuation/percent: pathauto_punctuation_percent + punctuation/period: pathauto_punctuation_period + punctuation/pipe: pathauto_punctuation_pipe + punctuation/plus: pathauto_punctuation_plus + punctuation/question_mark: pathauto_punctuation_question_mark + punctuation/quotes: pathauto_punctuation_quotes + punctuation/right_curly: pathauto_punctuation_right_curly + punctuation/right_parenthesis: pathauto_punctuation_right_parenthesis + punctuation/right_square: pathauto_punctuation_right_square + punctuation/semicolon: pathauto_punctuation_semicolon + punctuation/slash: pathauto_punctuation_slash + punctuation/tilde: pathauto_punctuation_tilde + punctuation/underscore: pathauto_punctuation_underscore verbose: pathauto_verbose separator: pathauto_separator max_length: pathauto_max_length diff --git a/pathauto.module b/pathauto.module index a73361d..ac7d9b0 100644 --- a/pathauto.module +++ b/pathauto.module @@ -25,9 +25,6 @@ use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; -use Drupal\migrate\Plugin\MigrateSourceInterface; -use Drupal\migrate\Plugin\MigrationInterface; -use Drupal\migrate\Row; use Drupal\pathauto\PathautoFieldItemList; use Drupal\pathauto\PathautoItem; @@ -180,23 +177,3 @@ function pathauto_pattern_validate($element, FormStateInterface $form_state) { return $element; } - -/** - * Implements hook_migrate_prepare_row(). - */ -function pathauto_migrate_prepare_row( - Row $row, - MigrateSourceInterface $source, - MigrationInterface $migration -) { - if (strpos($migration->getPluginId(), 'pathauto_settings') !== FALSE) { - // Join together punctuation variables into one array. - $punctuation = []; - foreach ($row->getSource() as $name => $value) { - if (strpos($name, 'pathauto_punctuation_') === 0) { - $punctuation[str_replace('pathauto_punctuation_', '', $name)] = $value; - } - } - $row->setSourceProperty('punctuation', $punctuation); - } -} diff --git a/src/Plugin/migrate/source/PathautoPattern.php b/src/Plugin/migrate/source/PathautoPattern.php index 95a533b..7efe3f4 100644 --- a/src/Plugin/migrate/source/PathautoPattern.php +++ b/src/Plugin/migrate/source/PathautoPattern.php @@ -4,7 +4,6 @@ namespace Drupal\pathauto\Plugin\migrate\source; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\State\StateInterface; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Row; @@ -19,12 +18,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * source_module = "pathauto", * ) */ -class PathautoPattern extends DrupalSqlBase implements ContainerFactoryPluginInterface { +class PathautoPattern extends DrupalSqlBase { /** * The entity type manager. * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface; + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; @@ -56,8 +55,7 @@ class PathautoPattern extends DrupalSqlBase implements ContainerFactoryPluginInt */ public function query() { // Fetch all pattern variables whose value is not a serialized empty string. - return $this->getDatabase() - ->select('variable', 'v') + return $this->select('variable', 'v') ->fields('v', ['name', 'value']) ->condition('name', 'pathauto_%_pattern', 'LIKE') ->condition('value', 's:0:"";', '<>'); @@ -76,8 +74,8 @@ class PathautoPattern extends DrupalSqlBase implements ContainerFactoryPluginInt */ public function fields() { return [ - 'name' => $this->t('The name of the pattern\'s variable.'), - 'value' => $this->t('The value of the pattern\'s variable.'), + 'name' => $this->t("The name of the pattern's variable."), + 'value' => $this->t("The value of the pattern's variable."), ]; }