Skip to content
Snippets Groups Projects
Commit 0c68b46e authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Merge branch 'ISAICP-7601' into 'master'

ISAICP-7601: Regression on existing listings not showing the facet tabs.

See merge request !70
parents 4f784000 79721a57
No related branches found
No related tags found
1 merge request!70ISAICP-7601: Regression on existing listings not showing the facet tabs.
...@@ -24,3 +24,6 @@ Feature: Covers Release 1.89. ...@@ -24,3 +24,6 @@ Feature: Covers Release 1.89.
Given I go to "/collection/joinup" Given I go to "/collection/joinup"
Then I should see 12 tiles Then I should see 12 tiles
Given I go to "/collection/semic-support-centre/overview"
Then I click "News" in the "Content listing types" inline facet
...@@ -403,6 +403,7 @@ protected static function getFacetIdFromAlias(string $alias): string { ...@@ -403,6 +403,7 @@ protected static function getFacetIdFromAlias(string $alias): string {
'EIF recommendations' => 'category', 'EIF recommendations' => 'category',
'Collection event date' => 'collection_event_type', 'Collection event date' => 'collection_event_type',
'Content types' => 'type', 'Content types' => 'type',
'Content listing types' => 'content_listing_type',
'eif principle' => 'principle', 'eif principle' => 'principle',
'eif interoperability layer' => 'interoperability_layer', 'eif interoperability layer' => 'interoperability_layer',
'eif conceptual model' => 'conceptual_model', 'eif conceptual model' => 'conceptual_model',
......
...@@ -446,3 +446,37 @@ function joinup_core_deploy_109001(): void { ...@@ -446,3 +446,37 @@ function joinup_core_deploy_109001(): void {
MetaEntity::loadOrCreate('topic', $term)->save(); MetaEntity::loadOrCreate('topic', $term)->save();
} }
} }
/**
* Updates the content listing paragraph type with the new field.
*/
function joinup_core_deploy_109004(array &$sandbox): string {
if (!isset($sandbox['total'])) {
// Load all content listing paragraph types.
$sandbox['paragraph_ids'] = \Drupal::entityQuery('paragraph')
->condition('type', 'content_listing', 'IN')
->condition('content_listing', 'field_content_listing_type', 'CONTAINS')
->execute();
$sandbox['total'] = count($sandbox['paragraph_ids']);
$sandbox['current'] = 0;
}
$paragraph_storage = \Drupal::entityTypeManager()->getStorage('paragraph');
$paragraph_ids = array_splice($sandbox['paragraph_ids'], 0, 50);
foreach ($paragraph_storage->loadMultiple($paragraph_ids) as $paragraph) {
$value = $paragraph->get('content_listing')->value;
if (!isset($value['fields']['field_content_listing_type'])) {
continue;
}
// Rename to 'content_listing_type'.
$value['fields']['content_listing_type'] = $value['fields']['field_content_listing_type'];
unset($value['fields']['field_content_listing_type']);
$paragraph->set('content_listing', ['value' => $value]);
$paragraph->save();
}
$sandbox['current'] += count($paragraph_ids);
$sandbox['#finished'] = empty($sandbox['paragraph_ids']) ? 1 : ($sandbox['current'] / $sandbox['total']);
return "Content listing paragraph type field migration: {$sandbox['current']} / {$sandbox['total']}";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment