Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #122 from dpc-sdp/feature/SDPAP-8290-add-contentty…
Browse files Browse the repository at this point in the history
…pe-content-collection

[SDPAP-8290]added hook update to apply new content type to existing sites
  • Loading branch information
yeniatencio authored Feb 19, 2024
2 parents 1c9f03d + 0940d63 commit fed8ca9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,7 @@ protected function buildContentTab(FieldItemListInterface $items, $delta, array
$content_types_options = $this->indexHelper->getNodeTypes();
$allowed_content_types = $settings['content']['internal']['contentTypes']['allowed_values'];
if (!empty($allowed_content_types)) {
$content_types_options = array_intersect_key($content_types_options,
array_flip($allowed_content_types));
$content_types_options = array_intersect_key($allowed_content_types, $content_types_options);
}
$element['tabs']['content']['contentTypes'] = [
'#type' => 'checkboxes',
Expand Down
18 changes: 18 additions & 0 deletions modules/tide_content_collection/tide_content_collection.install
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,21 @@ function _assign_content_collection_perm_site_admin() {
$role->save();
}
}

/**
* Add event and publication to content collection.
*/
function tide_content_collection_update_10000() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('core.entity_form_display.paragraph.content_collection_enhanced.default');
$allowed_content_types = [
'landing_page' => 'Landing Page',
'publication' => 'Publication',
'news' => 'News',
'event' => 'Events',
];
if ($config) {
$config->set('content.field_content_collection_config.settings.content.internal.contentTypes.allowed_values', $allowed_content_types);
$config->save();
}
}

0 comments on commit fed8ca9

Please sign in to comment.