From 3d5dedc1d01c1315f57389a5f39b6d0f1676503b Mon Sep 17 00:00:00 2001 From: Joshua Fernandes <83997348+joshua-salsadigital@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:24:40 +0530 Subject: [PATCH] Issue #3468224 by joshua1234511, richardgaunt, gargsuchi: Unknown view mode used in paragraph.civictheme_subject_card_ref.default.yml (#1298) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Joshua Fernandes <“joshua.1234511@yahoo.in”> --- web/themes/contrib/civictheme/civictheme.info.yml | 1 + .../contrib/civictheme/civictheme.post_update.php | 12 ++++++++++++ ...entity_view_mode.node.civictheme_subject_card.yml | 10 ++++++++++ web/themes/contrib/civictheme/includes/cards.inc | 11 +++++++++++ 4 files changed, 34 insertions(+) create mode 100644 web/themes/contrib/civictheme/config/install/core.entity_view_mode.node.civictheme_subject_card.yml diff --git a/web/themes/contrib/civictheme/civictheme.info.yml b/web/themes/contrib/civictheme/civictheme.info.yml index c3344c398..12c772d1b 100644 --- a/web/themes/contrib/civictheme/civictheme.info.yml +++ b/web/themes/contrib/civictheme/civictheme.info.yml @@ -240,6 +240,7 @@ config_devel: - core.entity_view_mode.node.civictheme_promo_card - core.entity_view_mode.node.civictheme_slider_slide - core.entity_view_mode.node.civictheme_snippet + - core.entity_view_mode.node.civictheme_subject_card - editor.editor.civictheme_rich_text - field.field.block_content.civictheme_banner.field_c_b_background_image - field.field.block_content.civictheme_banner.field_c_b_banner_blend_mode diff --git a/web/themes/contrib/civictheme/civictheme.post_update.php b/web/themes/contrib/civictheme/civictheme.post_update.php index 8edbb31f6..55ba3ef1d 100644 --- a/web/themes/contrib/civictheme/civictheme.post_update.php +++ b/web/themes/contrib/civictheme/civictheme.post_update.php @@ -759,3 +759,15 @@ function civictheme_post_update_enable_three_column_layout(): string { return implode("\n", $messages); } + +/** + * Import the missing subject card view mode configuration. + */ +function civictheme_post_update_import_subject_card_view_mode(): void { + $view_mode_configs = [ + 'core.entity_view_mode.node.civictheme_subject_card' => 'entity_view_mode', + ]; + $config_path = \Drupal::service('extension.list.theme')->getPath('civictheme') . '/config/install'; + \Drupal::classResolver(CivicthemeUpdateHelper::class)->createConfigs($view_mode_configs, $config_path); + +} diff --git a/web/themes/contrib/civictheme/config/install/core.entity_view_mode.node.civictheme_subject_card.yml b/web/themes/contrib/civictheme/config/install/core.entity_view_mode.node.civictheme_subject_card.yml new file mode 100644 index 000000000..a8f3812e6 --- /dev/null +++ b/web/themes/contrib/civictheme/config/install/core.entity_view_mode.node.civictheme_subject_card.yml @@ -0,0 +1,10 @@ +langcode: en +status: true +dependencies: + module: + - node +id: node.civictheme_subject_card +label: 'Subject Card' +description: '' +targetEntityType: node +cache: true diff --git a/web/themes/contrib/civictheme/includes/cards.inc b/web/themes/contrib/civictheme/includes/cards.inc index 0a96970b6..e48608b13 100644 --- a/web/themes/contrib/civictheme/includes/cards.inc +++ b/web/themes/contrib/civictheme/includes/cards.inc @@ -172,6 +172,17 @@ function civictheme_preprocess_paragraph__civictheme_subject_card(array &$variab _civictheme_preprocess_paragraph__paragraph_field__theme($variables); } +/** + * Implements template_preprocess_node(). + */ +function _civictheme_preprocess_node__civictheme_subject_card(array &$variables): void { + _civictheme_preprocess_paragraph__node_field__image($variables, CivicthemeConstants::SUBJECT_CARD_IMAGE_STYLE); + _civictheme_preprocess_paragraph__node_field__title($variables); + _civictheme_preprocess_paragraph__node_field__link($variables); + // @see civictheme_preprocess_views_view_grid() + $variables['theme'] = $variables['node']->component_theme ?? CivicthemeConstants::THEME_LIGHT; +} + /** * Implements template_preprocess_paragraph(). */