Skip to content

Commit

Permalink
Issue #3468224 by joshua1234511, richardgaunt, gargsuchi: Unknown vie…
Browse files Browse the repository at this point in the history
…w mode used in paragraph.civictheme_subject_card_ref.default.yml (#1298)

Co-authored-by: Joshua Fernandes <“[email protected]”>
  • Loading branch information
joshua-salsadigital and Joshua Fernandes authored Sep 19, 2024
1 parent 2e6fbf8 commit 3d5dedc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/themes/contrib/civictheme/civictheme.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions web/themes/contrib/civictheme/civictheme.post_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
langcode: en
status: true
dependencies:
module:
- node
id: node.civictheme_subject_card
label: 'Subject Card'
description: ''
targetEntityType: node
cache: true
11 changes: 11 additions & 0 deletions web/themes/contrib/civictheme/includes/cards.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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().
*/
Expand Down

0 comments on commit 3d5dedc

Please sign in to comment.