diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.event.text_card.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.event.text_card.yml new file mode 100644 index 0000000000..a63dff4ad5 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.event.text_card.yml @@ -0,0 +1,111 @@ +uuid: a6481e96-1a61-4bcb-ab69-ee86fa824777 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.text_card + - field.field.node.event.field_category + - field.field.node.event.field_event_cta + - field.field.node.event.field_event_date + - field.field.node.event.field_event_format + - field.field.node.event.field_event_type + - field.field.node.event.field_external_source + - field.field.node.event.field_login_required + - field.field.node.event.field_metatags + - field.field.node.event.field_tags + - field.field.node.event.field_teaser_media + - field.field.node.event.field_teaser_text + - field.field.node.event.field_teaser_title + - field.field.node.event.layout_builder__layout + - node.type.event + module: + - layout_builder + - layout_builder_restrictions + - link + - smart_date + - text + - user +third_party_settings: + layout_builder: + enabled: false + allow_custom: false + layout_builder_restrictions: + allowed_block_categories: { } + entity_view_mode_restriction: + allowed_layouts: { } + denylisted_blocks: { } + allowlisted_blocks: { } + restricted_categories: + - 'Chaos Tools' + - 'Content fields' + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core + entity_view_mode_restriction_by_region: + allowed_layouts: { } +id: node.event.text_card +targetEntityType: node +bundle: event +mode: text_card +content: + field_event_date: + type: smartdate_plain + label: hidden + settings: + timezone_override: '' + separator: '-' + third_party_settings: { } + weight: 2 + region: content + field_event_type: + type: entity_reference_label + label: hidden + settings: + link: false + third_party_settings: { } + weight: 3 + region: content + field_external_source: + type: link_separate + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + weight: 4 + region: content + field_teaser_text: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 1 + region: content + field_teaser_title: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + field_category: true + field_event_cta: true + field_event_format: true + field_login_required: true + field_metatags: true + field_tags: true + field_teaser_media: true + layout_builder__layout: true + links: true + search_api_excerpt: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.page.text_card.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.page.text_card.yml new file mode 100644 index 0000000000..03866e41c3 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.page.text_card.yml @@ -0,0 +1,190 @@ +uuid: a1fc9c7d-68c8-455b-9438-2e7a316ecedf +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.text_card + - field.field.node.page.field_external_source + - field.field.node.page.field_login_required + - field.field.node.page.field_metatags + - field.field.node.page.field_tags + - field.field.node.page.field_teaser_media + - field.field.node.page.field_teaser_text + - field.field.node.page.field_teaser_title + - field.field.node.page.layout_builder__layout + - node.type.page + module: + - layout_builder + - layout_builder_restrictions + - link + - text + - user +third_party_settings: + layout_builder: + enabled: false + allow_custom: false + layout_builder_restrictions: + allowed_block_categories: { } + entity_view_mode_restriction: + allowed_layouts: + - layout_onecol + - ys_layout_two_column + denylisted_blocks: { } + allowlisted_blocks: { } + restricted_categories: { } + entity_view_mode_restriction_by_region: + allowed_layouts: + - layout_onecol + - ys_layout_two_column + allowlisted_blocks: + ys_layout_banner: + all_regions: + 'Inline blocks': + - 'inline_block:cta_banner' + - 'inline_block:grand_hero' + ys_layout_page_meta: + all_regions: + 'YaleSites Layouts': + - page_meta_block + ys_layout_two_column: + content: + 'Custom block types': + - accordion + - button_link + - divider + - image + - pull_quote + - tabs + - text + - video + 'Inline blocks': + - 'inline_block:accordion' + - 'inline_block:button_link' + - 'inline_block:divider' + - 'inline_block:image' + - 'inline_block:pull_quote' + - 'inline_block:tabs' + - 'inline_block:text' + - 'inline_block:video' + sidebar: + 'Custom block types': + - text + 'Inline blocks': + - 'inline_block:text' + restricted_categories: + ys_layout_two_column: + content: + - 'Chaos Tools' + - 'Content fields' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites Layouts' + - 'YaleSites alert' + - core + sidebar: + - 'Chaos Tools' + - 'Content fields' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites Layouts' + - 'YaleSites alert' + - core + layout_onecol: + all_regions: + - 'Chaos Tools' + - 'Content fields' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites Layouts' + - 'YaleSites alert' + - core + ys_layout_banner: + all_regions: + - 'Chaos Tools' + - 'Content fields' + - 'Custom block types' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites Layouts' + - 'YaleSites alert' + - core + ys_layout_page_meta: + all_regions: + - 'Chaos Tools' + - 'Content fields' + - 'Custom block types' + - Devel + - Forms + - Help + - 'Inline blocks' + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core +id: node.page.text_card +targetEntityType: node +bundle: page +mode: text_card +content: + field_external_source: + type: link_separate + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + weight: 2 + region: content + field_teaser_text: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 1 + region: content + field_teaser_title: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + field_login_required: true + field_metatags: true + field_tags: true + field_teaser_media: true + layout_builder__layout: true + links: true + search_api_excerpt: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.post.text_card.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.post.text_card.yml new file mode 100644 index 0000000000..a521c74e3b --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.post.text_card.yml @@ -0,0 +1,91 @@ +uuid: eb41d84b-3d3a-4239-8d7b-97761e9f6777 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.text_card + - field.field.node.post.field_author + - field.field.node.post.field_category + - field.field.node.post.field_external_source + - field.field.node.post.field_login_required + - field.field.node.post.field_metatags + - field.field.node.post.field_publish_date + - field.field.node.post.field_tags + - field.field.node.post.field_teaser_media + - field.field.node.post.field_teaser_text + - field.field.node.post.field_teaser_title + - field.field.node.post.layout_builder__layout + - node.type.post + module: + - layout_builder + - layout_builder_restrictions + - link + - text + - user +third_party_settings: + layout_builder: + enabled: false + allow_custom: false + layout_builder_restrictions: + allowed_block_categories: { } + entity_view_mode_restriction: + allowed_layouts: { } + denylisted_blocks: { } + allowlisted_blocks: { } + restricted_categories: + - 'Chaos Tools' + - 'Content fields' + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core + entity_view_mode_restriction_by_region: + allowed_layouts: { } +id: node.post.text_card +targetEntityType: node +bundle: post +mode: text_card +content: + field_external_source: + type: link_separate + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + weight: 2 + region: content + field_teaser_text: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 1 + region: content + field_teaser_title: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + field_author: true + field_category: true + field_login_required: true + field_metatags: true + field_publish_date: true + field_tags: true + field_teaser_media: true + layout_builder__layout: true + links: true + search_api_excerpt: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.text_card.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.text_card.yml new file mode 100644 index 0000000000..2ebc261de7 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.text_card.yml @@ -0,0 +1,233 @@ +uuid: b2a049b3-09c3-427d-a759-71b42effe7ea +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.text_card + - field.field.node.profile.field_address + - field.field.node.profile.field_affiliation + - field.field.node.profile.field_department + - field.field.node.profile.field_email + - field.field.node.profile.field_external_source + - field.field.node.profile.field_first_name + - field.field.node.profile.field_honorific_prefix + - field.field.node.profile.field_last_name + - field.field.node.profile.field_login_required + - field.field.node.profile.field_media + - field.field.node.profile.field_metatags + - field.field.node.profile.field_position + - field.field.node.profile.field_subtitle + - field.field.node.profile.field_tags + - field.field.node.profile.field_teaser_media + - field.field.node.profile.field_teaser_text + - field.field.node.profile.field_teaser_title + - field.field.node.profile.field_telephone + - field.field.node.profile.layout_builder__layout + - node.type.profile + module: + - layout_builder + - layout_builder_restrictions + - link + - text + - user +third_party_settings: + layout_builder: + enabled: false + allow_custom: false + layout_builder_restrictions: + allowed_block_categories: + - 'Chaos Tools' + - 'Content fields' + - 'Custom block types' + - 'Custom blocks' + - Devel + - Forms + - Help + - 'Inline blocks' + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites Layouts' + - 'YaleSites alert' + - core + entity_view_mode_restriction: + allowed_layouts: + - layout_onecol + - ys_layout_two_column + denylisted_blocks: { } + allowlisted_blocks: + 'YaleSites Layouts': + - profile_contact_block + - profile_meta_block + restricted_categories: + - 'Chaos Tools' + - 'Content fields' + - 'Custom blocks' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core + entity_view_mode_restriction_by_region: + allowed_layouts: + - layout_onecol + - ys_layout_two_column + allowlisted_blocks: + layout_onecol: + all_regions: + 'YaleSites Layouts': + - profile_contact_block + ys_layout_two_column: + content: + 'Custom block types': + - accordion + - button_link + - divider + - image + - pull_quote + - tabs + - text + - video + 'Inline blocks': + - 'inline_block:accordion' + - 'inline_block:button_link' + - 'inline_block:divider' + - 'inline_block:image' + - 'inline_block:pull_quote' + - 'inline_block:tabs' + - 'inline_block:text' + - 'inline_block:video' + 'YaleSites Layouts': + - profile_contact_block + sidebar: + 'Custom block types': + - text + 'Inline blocks': + - 'inline_block:text' + 'YaleSites Layouts': + - profile_contact_block + denylisted_blocks: { } + restricted_categories: + ys_layout_two_column: + content: + - 'Chaos Tools' + - 'Content fields' + - 'Custom blocks' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core + sidebar: + - 'Chaos Tools' + - 'Content fields' + - 'Custom blocks' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core + layout_onecol: + all_regions: + - 'Chaos Tools' + - 'Content fields' + - 'Custom blocks' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core +id: node.profile.text_card +targetEntityType: node +bundle: profile +mode: text_card +content: + field_external_source: + type: link_separate + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + weight: 5 + region: content + field_media: + type: entity_reference_entity_view + label: hidden + settings: + view_mode: default + link: false + third_party_settings: { } + weight: 0 + region: content + field_position: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 3 + region: content + field_subtitle: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 4 + region: content + field_teaser_text: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 2 + region: content + field_teaser_title: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 1 + region: content +hidden: + field_address: true + field_affiliation: true + field_department: true + field_email: true + field_first_name: true + field_honorific_prefix: true + field_last_name: true + field_login_required: true + field_metatags: true + field_tags: true + field_teaser_media: true + field_telephone: true + layout_builder__layout: true + links: true + search_api_excerpt: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_mode.node.card.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_mode.node.card.yml index 9e41923b1c..ed2d7d4497 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_mode.node.card.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_mode.node.card.yml @@ -5,6 +5,6 @@ dependencies: module: - node id: node.card -label: Card +label: 'Visual Card' targetEntityType: node cache: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_mode.node.text_card.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_mode.node.text_card.yml new file mode 100644 index 0000000000..11abf940fa --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_mode.node.text_card.yml @@ -0,0 +1,10 @@ +uuid: 7d628f57-b603-4c10-bf70-4222ae9ae55a +langcode: en +status: true +dependencies: + module: + - node +id: node.text_card +label: 'Text Card' +targetEntityType: node +cache: true diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-text-card-grid.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-text-card-grid.svg new file mode 100644 index 0000000000..8742fd6da7 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-text-card-grid.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php index 1dc184d303..1505c17638 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php @@ -119,6 +119,7 @@ public function render() { // Map the view mode in Drupal to the type attribute for the component. $viewModesMap = [ 'card' => 'grid', + 'text_card' => 'grid', 'list_item' => 'list', 'condensed' => 'condensed', 'directory' => 'profile-directory', diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index f9806fea2f..e572e7491d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -42,10 +42,15 @@ class ViewsBasicManager extends ControllerBase implements ContainerInjectionInte 'img_alt' => 'Speech bubble icon', 'view_modes' => [ 'card' => [ - 'label' => 'Post Card Grid', + 'label' => 'Post Visual Cards', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-card-grid.svg', 'img_alt' => 'Icon showing 3 generic cards next to each other. Image placement is on the top of each card.', ], + 'text_card' => [ + 'label' => 'Post Text Cards', + 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-text-card-grid.svg', + 'img_alt' => 'Icon showing 3 generic cards next to each other with no images on the cards.', + ], 'list_item' => [ 'label' => 'Post List', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-list-view.svg', @@ -68,10 +73,15 @@ class ViewsBasicManager extends ControllerBase implements ContainerInjectionInte 'img_alt' => 'Calendar icon', 'view_modes' => [ 'card' => [ - 'label' => 'Event Card Grid', + 'label' => 'Event Visual Cards', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-card-grid.svg', 'img_alt' => 'Icon showing 3 generic cards next to each other. Image placement is on the top of each card.', ], + 'text_card' => [ + 'label' => 'Event Text Cards', + 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-text-card-grid.svg', + 'img_alt' => 'Icon showing 3 generic cards next to each other with no images on the cards.', + ], 'list_item' => [ 'label' => 'Event List', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-list-view.svg', @@ -94,10 +104,15 @@ class ViewsBasicManager extends ControllerBase implements ContainerInjectionInte 'img_alt' => 'Blank page icon', 'view_modes' => [ 'card' => [ - 'label' => 'Page Grid', + 'label' => 'Page Visual Cards', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-card-grid.svg', 'img_alt' => 'Icon showing 3 generic cards next to each other. Image placement is on the top of each card.', ], + 'text_card' => [ + 'label' => 'Page Text Cards', + 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-text-card-grid.svg', + 'img_alt' => 'Icon showing 3 generic cards next to each other with no images on the cards.', + ], 'list_item' => [ 'label' => 'Page List', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-list-view.svg', @@ -120,10 +135,15 @@ class ViewsBasicManager extends ControllerBase implements ContainerInjectionInte 'img_alt' => 'Generic person head icon', 'view_modes' => [ 'card' => [ - 'label' => 'Profile Grid', + 'label' => 'Profile Visual Cards', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-card-grid.svg', 'img_alt' => 'Icon showing 3 generic cards next to each other. Image placement is on the top of each card.', ], + 'text_card' => [ + 'label' => 'Profile Text Cards', + 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-text-card-grid.svg', + 'img_alt' => 'Icon showing 3 generic cards next to each other with no images on the cards.', + ], 'list_item' => [ 'label' => 'Profile List', 'img' => '/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/display-type-list-view.svg', @@ -441,10 +461,12 @@ public function getView($type, $params) { // This ensures that if the options for showing categories, tags, // or thumbnails change, the cache will be invalidated, // and the view will be re-rendered with the new options. - foreach ($view['#rows']['#rows'] as &$resultRow) { - $resultRow['#cache']['keys'][] = $field_display_options['show_categories']; - $resultRow['#cache']['keys'][] = $field_display_options['show_tags']; - $resultRow['#cache']['keys'][] = $field_display_options['show_thumbnail']; + if (!empty($view['#rows']['#rows'])) { + foreach ($view['#rows']['#rows'] as &$resultRow) { + $resultRow['#cache']['keys'][] = $field_display_options['show_categories']; + $resultRow['#cache']['keys'][] = $field_display_options['show_tags']; + $resultRow['#cache']['keys'][] = $field_display_options['show_thumbnail']; + } } break;