Skip to content

Commit 3d5dedc

Browse files
joshua-salsadigitalJoshua Fernandes
andauthored
Issue #3468224 by joshua1234511, richardgaunt, gargsuchi: Unknown view mode used in paragraph.civictheme_subject_card_ref.default.yml (#1298)
Co-authored-by: Joshua Fernandes <“[email protected]”>
1 parent 2e6fbf8 commit 3d5dedc

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

web/themes/contrib/civictheme/civictheme.info.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ config_devel:
240240
- core.entity_view_mode.node.civictheme_promo_card
241241
- core.entity_view_mode.node.civictheme_slider_slide
242242
- core.entity_view_mode.node.civictheme_snippet
243+
- core.entity_view_mode.node.civictheme_subject_card
243244
- editor.editor.civictheme_rich_text
244245
- field.field.block_content.civictheme_banner.field_c_b_background_image
245246
- field.field.block_content.civictheme_banner.field_c_b_banner_blend_mode

web/themes/contrib/civictheme/civictheme.post_update.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,3 +759,15 @@ function civictheme_post_update_enable_three_column_layout(): string {
759759

760760
return implode("\n", $messages);
761761
}
762+
763+
/**
764+
* Import the missing subject card view mode configuration.
765+
*/
766+
function civictheme_post_update_import_subject_card_view_mode(): void {
767+
$view_mode_configs = [
768+
'core.entity_view_mode.node.civictheme_subject_card' => 'entity_view_mode',
769+
];
770+
$config_path = \Drupal::service('extension.list.theme')->getPath('civictheme') . '/config/install';
771+
\Drupal::classResolver(CivicthemeUpdateHelper::class)->createConfigs($view_mode_configs, $config_path);
772+
773+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
module:
5+
- node
6+
id: node.civictheme_subject_card
7+
label: 'Subject Card'
8+
description: ''
9+
targetEntityType: node
10+
cache: true

web/themes/contrib/civictheme/includes/cards.inc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,17 @@ function civictheme_preprocess_paragraph__civictheme_subject_card(array &$variab
172172
_civictheme_preprocess_paragraph__paragraph_field__theme($variables);
173173
}
174174

175+
/**
176+
* Implements template_preprocess_node().
177+
*/
178+
function _civictheme_preprocess_node__civictheme_subject_card(array &$variables): void {
179+
_civictheme_preprocess_paragraph__node_field__image($variables, CivicthemeConstants::SUBJECT_CARD_IMAGE_STYLE);
180+
_civictheme_preprocess_paragraph__node_field__title($variables);
181+
_civictheme_preprocess_paragraph__node_field__link($variables);
182+
// @see civictheme_preprocess_views_view_grid()
183+
$variables['theme'] = $variables['node']->component_theme ?? CivicthemeConstants::THEME_LIGHT;
184+
}
185+
175186
/**
176187
* Implements template_preprocess_paragraph().
177188
*/

0 commit comments

Comments
 (0)