Skip to content

Commit

Permalink
Merge pull request #231 from localgovdrupal/feature/57/card-view-mode
Browse files Browse the repository at this point in the history
adds a dedicated card view mode
  • Loading branch information
finnlewis committed Jul 16, 2024
2 parents dc631ad + 2166395 commit 1e3c35b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config/install/core.entity_view_mode.node.localgov_card.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
langcode: en
status: true
dependencies:
module:
- node
id: node.localgov_card
label: 'LocalGov Card'
description: ''
targetEntityType: node
cache: true
16 changes: 16 additions & 0 deletions localgov_core.install
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,19 @@ function localgov_core_update_8002() {
}
}
}

/**
* Add a localgov_card view mode.
*/
function localgov_core_update_8003() {
$view_mode = \Drupal::entityTypeManager()->getStorage('entity_view_mode')->load('node.localgov_card');
if (!$view_mode) {
$view_mode = \Drupal::entityTypeManager()->getStorage('entity_view_mode')->create([
'id' => 'node.localgov_card',
'targetEntityType' => 'node',
'status' => TRUE,
'label' => 'LocalGov Card',
]);
$view_mode->save();
}
}

0 comments on commit 1e3c35b

Please sign in to comment.