From 558453776eb7533531fbac17c76bb12005693377 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 21 Jul 2023 16:29:14 -0700 Subject: [PATCH] feat(YALB-1441): Add profile contact block, config for profiles, and updated permissions for profiles --- ...tity_form_display.node.profile.default.yml | 8 ++ ....entity_view_display.node.profile.card.yml | 2 + ...ty_view_display.node.profile.condensed.yml | 2 + ...tity_view_display.node.profile.default.yml | 130 +++++++++++++++++- ...ty_view_display.node.profile.directory.yml | 2 + ...ty_view_display.node.profile.list_item.yml | 2 + ...iew_display.node.profile.search_result.yml | 2 + ...ntity_view_display.node.profile.teaser.yml | 2 + ...field.field.node.profile.field_address.yml | 61 ++++++++ .../sync/field.storage.node.field_address.yml | 19 +++ ...der_browser_block.profile_contact_info.yml | 11 ++ .../config/sync/user.role.platform_admin.yml | 10 ++ .../config/sync/user.role.site_admin.yml | 10 ++ .../src/Plugin/Block/PostMetaBlock.php | 1 - .../src/Plugin/Block/ProfileContactBlock.php | 83 +++++++++++ .../src/Plugin/Block/ProfileMetaBlock.php | 9 +- .../ys-profile-contact-block.html.twig | 53 +++++++ .../templates/ys-profile-meta-block.html.twig | 13 +- .../custom/ys_layouts/ys_layouts.module | 15 +- 19 files changed, 414 insertions(+), 21 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/config/sync/field.field.node.profile.field_address.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/field.storage.node.field_address.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/layout_builder_browser.layout_builder_browser_block.profile_contact_info.yml create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileContactBlock.php create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-contact-block.html.twig diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.node.profile.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.node.profile.default.yml index bf97e09539..cc95219dd9 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.node.profile.default.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.node.profile.default.yml @@ -3,6 +3,7 @@ langcode: en status: true dependencies: config: + - field.field.node.profile.field_address - field.field.node.profile.field_affiliation - field.field.node.profile.field_department - field.field.node.profile.field_email @@ -19,6 +20,7 @@ dependencies: - field.field.node.profile.layout_builder__layout - node.type.profile module: + - address - allowed_formats - field_group - maxlength @@ -65,6 +67,12 @@ targetEntityType: node bundle: profile mode: default content: + field_address: + type: address_default + weight: 19 + region: content + settings: { } + third_party_settings: { } field_affiliation: type: options_select weight: 5 diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.card.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.card.yml index 448bff0e38..e091db18ef 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.card.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.card.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - core.entity_view_mode.node.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 @@ -72,6 +73,7 @@ content: weight: 1 region: content hidden: + field_address: true field_affiliation: true field_department: true field_email: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.condensed.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.condensed.yml index 714a2a1d0b..4425956776 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.condensed.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.condensed.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - core.entity_view_mode.node.condensed + - field.field.node.profile.field_address - field.field.node.profile.field_affiliation - field.field.node.profile.field_department - field.field.node.profile.field_email @@ -50,6 +51,7 @@ content: weight: 0 region: content hidden: + field_address: true field_affiliation: true field_department: true field_email: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.default.yml index f17c9ed1e7..298210fd4f 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.default.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.default.yml @@ -3,6 +3,8 @@ langcode: en status: true dependencies: config: + - block_content.type.text + - field.field.node.profile.field_address - field.field.node.profile.field_affiliation - field.field.node.profile.field_department - field.field.node.profile.field_email @@ -19,6 +21,7 @@ dependencies: - field.field.node.profile.layout_builder__layout - node.type.profile module: + - address - layout_builder - layout_builder_restrictions - layout_discovery @@ -64,22 +67,139 @@ third_party_settings: layout_settings: label: 'Content Section' context_mapping: { } - components: { } + components: + c60f8771-bc1b-46f1-85f5-0bb81f03eb82: + uuid: c60f8771-bc1b-46f1-85f5-0bb81f03eb82 + region: sidebar + configuration: + id: profile_contact_block + label: 'Profile Contact Block' + label_display: '' + provider: ys_layouts + context_mapping: { } + weight: 0 + additional: { } + 144cbef4-6f56-4e24-9040-a479993c5c45: + uuid: 144cbef4-6f56-4e24-9040-a479993c5c45 + region: content + configuration: + id: 'inline_block:text' + label: 'Default Text' + label_display: '' + provider: layout_builder + view_mode: full + context_mapping: { } + block_revision_id: 1097 + block_serialized: null + weight: 0 + additional: { } third_party_settings: { } layout_builder_restrictions: allowed_block_categories: { } entity_view_mode_restriction: - allowed_layouts: { } + allowed_layouts: + - layout_onecol + - ys_layout_two_column denylisted_blocks: { } - allowlisted_blocks: { } - restricted_categories: { } + allowlisted_blocks: + 'YaleSites Layouts': + - profile_contact_block + restricted_categories: + - 'Chaos Tools' + - 'Content fields' + - 'Custom block types' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core entity_view_mode_restriction_by_region: - allowed_layouts: { } + allowed_layouts: + - layout_onecol + - ys_layout_two_column + allowlisted_blocks: + layout_onecol: + all_regions: + 'YaleSites Layouts': + - profile_contact_block + ys_layout_two_column: + content: + 'YaleSites Layouts': + - profile_contact_block + sidebar: + 'Inline blocks': + - 'inline_block:text' + 'YaleSites Layouts': + - profile_contact_block + denylisted_blocks: + ys_layout_two_column: + content: + 'Inline blocks': + - 'inline_block:cta_banner' + - 'inline_block:callout' + - 'inline_block:grand_hero' + restricted_categories: + ys_layout_two_column: + sidebar: + - 'Chaos Tools' + - 'Content fields' + - 'Custom block types' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core + content: + - 'Chaos Tools' + - 'Content fields' + - 'Custom block types' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core + layout_onecol: + all_regions: + - 'Chaos Tools' + - 'Content fields' + - 'Custom block types' + - Devel + - Forms + - Help + - 'Lists (Views)' + - Menus + - System + - Webform + - 'YaleSites Core' + - 'YaleSites alert' + - core id: node.profile.default targetEntityType: node bundle: profile mode: default content: + field_address: + type: address_default + label: above + settings: { } + third_party_settings: { } + weight: 115 + region: content field_affiliation: type: entity_reference_label label: above diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.directory.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.directory.yml index 9f8dc4b365..5caee0eca2 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.directory.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.directory.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - core.entity_view_mode.node.directory + - field.field.node.profile.field_address - field.field.node.profile.field_affiliation - field.field.node.profile.field_department - field.field.node.profile.field_email @@ -98,6 +99,7 @@ content: weight: 3 region: content hidden: + field_address: true field_login_required: true field_metatags: true field_tags: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.list_item.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.list_item.yml index d226593095..7fb09cd763 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.list_item.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.list_item.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - core.entity_view_mode.node.list_item + - field.field.node.profile.field_address - field.field.node.profile.field_affiliation - field.field.node.profile.field_department - field.field.node.profile.field_email @@ -72,6 +73,7 @@ content: weight: 1 region: content hidden: + field_address: true field_affiliation: true field_department: true field_email: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.search_result.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.search_result.yml index d2a8d321e6..3630dc341c 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.search_result.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.search_result.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - core.entity_view_mode.node.search_result + - field.field.node.profile.field_address - field.field.node.profile.field_affiliation - field.field.node.profile.field_department - field.field.node.profile.field_email @@ -45,6 +46,7 @@ content: weight: 0 region: content hidden: + field_address: true field_affiliation: true field_department: true field_email: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.teaser.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.teaser.yml index 1c64bc3144..f28bdba7b7 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.teaser.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.node.profile.teaser.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - core.entity_view_mode.node.teaser + - field.field.node.profile.field_address - field.field.node.profile.field_affiliation - field.field.node.profile.field_department - field.field.node.profile.field_email @@ -32,6 +33,7 @@ content: weight: 100 region: content hidden: + field_address: true field_affiliation: true field_department: true field_email: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.node.profile.field_address.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.node.profile.field_address.yml new file mode 100644 index 0000000000..98cebeb98f --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.node.profile.field_address.yml @@ -0,0 +1,61 @@ +uuid: dd54a6d3-80ab-4cbc-a5de-0ba5d116765c +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_address + - node.type.profile + module: + - address +id: node.profile.field_address +field_name: field_address +entity_type: node +bundle: profile +label: Address +description: '' +required: false +translatable: false +default_value: + - + langcode: null + country_code: US + administrative_area: '' + locality: '' + dependent_locality: null + postal_code: '' + sorting_code: null + address_line1: '' + address_line2: '' + organization: null + given_name: null + additional_name: null + family_name: null +default_value_callback: '' +settings: + available_countries: { } + langcode_override: '' + field_overrides: + givenName: + override: hidden + additionalName: + override: hidden + familyName: + override: hidden + organization: + override: hidden + addressLine1: + override: optional + addressLine2: + override: optional + postalCode: + override: optional + sortingCode: + override: hidden + dependentLocality: + override: optional + locality: + override: optional + administrativeArea: + override: optional + fields: { } +field_type: address diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.storage.node.field_address.yml b/web/profiles/custom/yalesites_profile/config/sync/field.storage.node.field_address.yml new file mode 100644 index 0000000000..cc154d10b8 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/field.storage.node.field_address.yml @@ -0,0 +1,19 @@ +uuid: b6c01928-faee-46a6-a157-21c784bb7b37 +langcode: en +status: true +dependencies: + module: + - address + - node +id: node.field_address +field_name: field_address +entity_type: node +type: address +settings: { } +module: address +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/web/profiles/custom/yalesites_profile/config/sync/layout_builder_browser.layout_builder_browser_block.profile_contact_info.yml b/web/profiles/custom/yalesites_profile/config/sync/layout_builder_browser.layout_builder_browser_block.profile_contact_info.yml new file mode 100644 index 0000000000..f8c3131c59 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/layout_builder_browser.layout_builder_browser_block.profile_contact_info.yml @@ -0,0 +1,11 @@ +uuid: 64dc2440-2827-4ce3-a09a-b8c15a9e9cdf +langcode: en +status: true +dependencies: { } +id: profile_contact_info +block_id: profile_contact_block +category: basic +label: 'Profile Contact Info' +image_path: '' +image_alt: '' +weight: -100 diff --git a/web/profiles/custom/yalesites_profile/config/sync/user.role.platform_admin.yml b/web/profiles/custom/yalesites_profile/config/sync/user.role.platform_admin.yml index acf5d0e657..c986ac3a8f 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/user.role.platform_admin.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/user.role.platform_admin.yml @@ -6,6 +6,7 @@ dependencies: - core.entity_view_display.node.event.default - core.entity_view_display.node.page.default - core.entity_view_display.node.post.default + - core.entity_view_display.node.profile.default - media.type.background_video - media.type.document - media.type.embed @@ -14,6 +15,7 @@ dependencies: - node.type.event - node.type.page - node.type.post + - node.type.profile - taxonomy.vocabulary.event_category - taxonomy.vocabulary.post_category - taxonomy.vocabulary.tags @@ -65,6 +67,7 @@ permissions: - 'configure editable event node layout overrides' - 'configure editable page node layout overrides' - 'configure editable post node layout overrides' + - 'configure editable profile node layout overrides' - 'create accordion block content' - 'create and edit custom blocks' - 'create background_video media' @@ -88,6 +91,7 @@ permissions: - 'create page content' - 'create post content' - 'create post_list block content' + - 'create profile content' - 'create pull_quote block content' - 'create quick_links block content' - 'create tabs block content' @@ -123,6 +127,7 @@ permissions: - 'delete any page content' - 'delete any post content' - 'delete any post_list block content' + - 'delete any profile content' - 'delete any pull_quote block content' - 'delete any quick_links block content' - 'delete any tabs block content' @@ -141,6 +146,7 @@ permissions: - 'delete own image media' - 'delete own page content' - 'delete own post content' + - 'delete own profile content' - 'delete own video media' - 'delete terms in event_category' - 'delete terms in post_category' @@ -152,6 +158,7 @@ permissions: - 'edit any image media' - 'edit any page content' - 'edit any post content' + - 'edit any profile content' - 'edit any video media' - 'edit any webform submission' - 'edit own background_video media' @@ -161,6 +168,7 @@ permissions: - 'edit own image media' - 'edit own page content' - 'edit own post content' + - 'edit own profile content' - 'edit own video media' - 'edit own webform submission' - 'edit terms in event_category' @@ -178,6 +186,7 @@ permissions: - 'revert event revisions' - 'revert page revisions' - 'revert post revisions' + - 'revert profile revisions' - 'unpublish any content' - 'unpublish editable content' - 'update any accordion block content' @@ -214,6 +223,7 @@ permissions: - 'view own webform submission' - 'view page revisions' - 'view post revisions' + - 'view profile revisions' - 'view the administration theme' - 'view unpublished paragraphs' - 'yalesites manage alerts' diff --git a/web/profiles/custom/yalesites_profile/config/sync/user.role.site_admin.yml b/web/profiles/custom/yalesites_profile/config/sync/user.role.site_admin.yml index 1efaa6d73b..2a507ab9cf 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/user.role.site_admin.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/user.role.site_admin.yml @@ -6,6 +6,7 @@ dependencies: - core.entity_view_display.node.event.default - core.entity_view_display.node.page.default - core.entity_view_display.node.post.default + - core.entity_view_display.node.profile.default - media.type.background_video - media.type.document - media.type.embed @@ -14,6 +15,7 @@ dependencies: - node.type.event - node.type.page - node.type.post + - node.type.profile - taxonomy.vocabulary.event_category - taxonomy.vocabulary.post_category - taxonomy.vocabulary.tags @@ -62,6 +64,7 @@ permissions: - 'configure editable event node layout overrides' - 'configure editable page node layout overrides' - 'configure editable post node layout overrides' + - 'configure editable profile node layout overrides' - 'create accordion block content' - 'create and edit custom blocks' - 'create background_video media' @@ -85,6 +88,7 @@ permissions: - 'create page content' - 'create post content' - 'create post_list block content' + - 'create profile content' - 'create pull_quote block content' - 'create quick_links block content' - 'create tabs block content' @@ -120,6 +124,7 @@ permissions: - 'delete any page content' - 'delete any post content' - 'delete any post_list block content' + - 'delete any profile content' - 'delete any pull_quote block content' - 'delete any quick_links block content' - 'delete any tabs block content' @@ -138,6 +143,7 @@ permissions: - 'delete own image media' - 'delete own page content' - 'delete own post content' + - 'delete own profile content' - 'delete own video media' - 'delete terms in event_category' - 'delete terms in post_category' @@ -149,6 +155,7 @@ permissions: - 'edit any image media' - 'edit any page content' - 'edit any post content' + - 'edit any profile content' - 'edit any video media' - 'edit any webform submission' - 'edit own background_video media' @@ -158,6 +165,7 @@ permissions: - 'edit own image media' - 'edit own page content' - 'edit own post content' + - 'edit own profile content' - 'edit own video media' - 'edit own webform submission' - 'edit terms in event_category' @@ -172,6 +180,7 @@ permissions: - 'revert event revisions' - 'revert page revisions' - 'revert post revisions' + - 'revert profile revisions' - 'unpublish any content' - 'unpublish editable content' - 'update any accordion block content' @@ -208,6 +217,7 @@ permissions: - 'view own webform submission' - 'view page revisions' - 'view post revisions' + - 'view profile revisions' - 'view the administration theme' - 'view unpublished paragraphs' - 'yalesites manage alerts' diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/PostMetaBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/PostMetaBlock.php index f518fd98b8..d9ff1779ac 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/PostMetaBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/PostMetaBlock.php @@ -4,7 +4,6 @@ use Drupal\Core\Block\BlockBase; use Drupal\Core\Controller\TitleResolver; -use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileContactBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileContactBlock.php new file mode 100644 index 0000000000..29e3669528 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileContactBlock.php @@ -0,0 +1,83 @@ +routeMatch = $route_match; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('current_route_match') + ); + } + + /** + * {@inheritdoc} + */ + public function build() { + + /** @var \Drupal\node\NodeInterface $node */ + $node = $this->routeMatch->getParameter('node'); + if (!($node instanceof NodeInterface)) { + return []; + } + + // Profile fields. + $email = ($node->field_email->first()) ? $node->field_email->first()->getValue()['value'] : NULL; + $phone = ($node->field_telephone->first()) ? $node->field_telephone->first()->getValue()['value'] : NULL; + $address = ($node->field_address->first()) ? $node->field_address->first()->getValue() : NULL; + + return [ + '#theme' => 'ys_profile_contact_block', + '#email' => $email, + '#phone' => $phone, + '#address' => $address, + ]; + } + +} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileMetaBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileMetaBlock.php index fef6844b2a..037dcff930 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileMetaBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/src/Plugin/Block/ProfileMetaBlock.php @@ -7,7 +7,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\node\NodeInterface; -use Drupal\Core\Url; /** * Block for profile meta data that appears above profiles. @@ -77,10 +76,10 @@ public function build() { return [ '#theme' => 'ys_profile_meta_block', - '#name' => $title, - '#position' => $position, - '#subtitle' => $subtitle, - '#department' => $department, + '#profile_meta__heading' => $title, + '#profile_meta__title_line' => $position, + '#profile_meta__subtitle_line' => $subtitle, + '#profile_meta__department' => $department, '#media_id' => $mediaId, ]; } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-contact-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-contact-block.html.twig new file mode 100644 index 0000000000..82ae4fe9fe --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-contact-block.html.twig @@ -0,0 +1,53 @@ + + +{% embed '@atoms/typography/headings/yds-heading.twig' with { + heading: 'Contact Info', + heading__level: '3', +} %} +{% endembed %} + +{% if email %} + + {{ attach_library('atomic/text-link') }} + {% embed '@atoms/controls/text-link/yds-text-link.twig' with { + link__url: '', + link__pre_text: email, + link__content: '(copy)', + link__type: 'email', + link__extra_class: ['copy-trigger'], + } %} + +{% endembed %} + +{% endif %} + +{% if phone %} + + {% embed '@atoms/controls/text-link/yds-text-link.twig' with { + link__url: 'tel:' ~ phone, + link__content: phone, + } %} + + {% endembed %} + +{% endif %} + +{% if address %} + + {% set address %} + {{ address.address_line1 }}
+ {{ address.address_line2 }}
+ {% if address.locality %} + {{ address.locality }}, + {% endif %} + {{ address.administrative_area }} {{ address.postal_code }} + {% endset %} + + {% embed '@molecules/text/yds-text-field.twig' with { + text_field__content: address, + text_field__alignment: 'left' + } %} + +{% endembed %} + +{% endif %} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-meta-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-meta-block.html.twig index f0d8c52934..e8367a811d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-meta-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/templates/ys-profile-meta-block.html.twig @@ -1,6 +1,7 @@ -Name: {{ name }}
-Position: {{ position }}
-Subtitle: {{ subtitle }}
-Department: {{ department }}
- -{{ drupal_entity('media', media_id, 'card_secondary_3_2') }} +{% embed '@molecules/meta/profile-meta/yds-profile-meta.twig' %} + {% block profile__image %} + {% if media_id %} + {{ drupal_entity('media', media_id, 'card_secondary_3_2') }} + {% endif %} + {% endblock %} +{% endembed %} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/ys_layouts.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/ys_layouts.module index 347b00a738..e2e3c3d74d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/ys_layouts.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_layouts/ys_layouts.module @@ -39,12 +39,19 @@ function ys_layouts_theme($existing, $type, $theme, $path): array { ], 'ys_profile_meta_block' => [ 'variables' => [ - 'name' => NULL, - 'position' => NULL, - 'subtitle' => NULL, - 'department' => NULL, + 'profile_meta__heading' => NULL, + 'profile_meta__title_line' => NULL, + 'profile_meta__subtitle_line' => NULL, + 'profile_meta__department' => NULL, 'media_id' => NULL, ], ], + 'ys_profile_contact_block' => [ + 'variables' => [ + 'email' => NULL, + 'phone' => NULL, + 'address' => [], + ], + ], ]; }