Skip to content

Commit

Permalink
Merge pull request #144 from localgovdrupal/2.x
Browse files Browse the repository at this point in the history
Release 2.1.6
  • Loading branch information
finnlewis authored Aug 8, 2022
2 parents 64b90ec + ad612cf commit bae9625
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"license": "GPL-2.0-or-later",
"minimum-stability": "dev",
"require": {
"drupal/ctools": "3.9",
"drupal/field_group": "^3.1",
"drupal/image_widget_crop": "^2.3",
"drupal/linkit": "^6.0-beta1",
Expand Down
27 changes: 27 additions & 0 deletions localgov_core.install
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,30 @@ function localgov_core_update_8001(&$sandbox) {

return t('Please export your sites configuration! Config entities for localgov_core where updated.');
}

/**
* Update node type conditions from node_type to entity_bundle.
*
* @see pathauto_update_8108()
* This runs the same update for any sites that installed our default pathauto
* patters after the pathauto update was added.
*/
function localgov_core_update_8002() {
// Load all pattern configuration entities.
foreach (\Drupal::configFactory()->listAll('pathauto.pattern.') as $pattern_config_name) {
$pattern_config = \Drupal::configFactory()->getEditable($pattern_config_name);

// Loop patterns and swap the node_type plugin by the entity_bundle:node
// plugin.
if ($pattern_config->get('type') === 'canonical_entities:node') {
$selection_criteria = $pattern_config->get('selection_criteria');
foreach ($selection_criteria as $uuid => $condition) {
if ($condition['id'] === 'node_type') {
$pattern_config->set("selection_criteria.$uuid.id", 'entity_bundle:node');
$pattern_config->save();
break;
}
}
}
}
}

0 comments on commit bae9625

Please sign in to comment.