diff --git a/config/sync/core.entity_form_display.node.stanford_page.default.yml b/config/sync/core.entity_form_display.node.stanford_page.default.yml index 7a9b29855..1d2944c2b 100644 --- a/config/sync/core.entity_form_display.node.stanford_page.default.yml +++ b/config/sync/core.entity_form_display.node.stanford_page.default.yml @@ -132,7 +132,7 @@ content: closed_mode: preview autocollapse: none closed_mode_threshold: 0 - add_mode: button + add_mode: dropdown form_display_mode: default default_paragraph_type: _none features: diff --git a/config/sync/core.entity_form_display.paragraph.stanford_top_banner.default.yml b/config/sync/core.entity_form_display.paragraph.stanford_top_banner.default.yml new file mode 100644 index 000000000..764e6d7ee --- /dev/null +++ b/config/sync/core.entity_form_display.paragraph.stanford_top_banner.default.yml @@ -0,0 +1,62 @@ +uuid: 2a03161c-0527-4c91-adda-bdc596f22781 +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.stanford_top_banner.su_banner_body + - field.field.paragraph.stanford_top_banner.su_banner_button + - field.field.paragraph.stanford_top_banner.su_banner_header + - field.field.paragraph.stanford_top_banner.su_banner_image + - field.field.paragraph.stanford_top_banner.su_banner_sup_header + - paragraphs.paragraphs_type.stanford_top_banner + module: + - link + - media_library + - text +id: paragraph.stanford_top_banner.default +targetEntityType: paragraph +bundle: stanford_top_banner +mode: default +content: + su_banner_body: + type: text_textarea + weight: 3 + region: content + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + su_banner_button: + type: link_default + weight: 4 + region: content + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + su_banner_header: + type: string_textfield + weight: 2 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + su_banner_image: + type: media_library_widget + weight: 0 + region: content + settings: + media_types: { } + third_party_settings: { } + su_banner_sup_header: + type: string_textfield + weight: 1 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } +hidden: + created: true + status: true diff --git a/config/sync/core.entity_view_display.paragraph.stanford_top_banner.default.yml b/config/sync/core.entity_view_display.paragraph.stanford_top_banner.default.yml new file mode 100644 index 000000000..b63336e3e --- /dev/null +++ b/config/sync/core.entity_view_display.paragraph.stanford_top_banner.default.yml @@ -0,0 +1,105 @@ +uuid: 5c8b4160-65a4-4138-8815-7830bc9fc0a1 +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.stanford_top_banner.su_banner_body + - field.field.paragraph.stanford_top_banner.su_banner_button + - field.field.paragraph.stanford_top_banner.su_banner_header + - field.field.paragraph.stanford_top_banner.su_banner_image + - field.field.paragraph.stanford_top_banner.su_banner_sup_header + - paragraphs.paragraphs_type.stanford_top_banner + module: + - ds + - empty_fields + - field_formatter_class + - link + - stanford_fields + - stanford_media + - text +third_party_settings: + ds: + layout: + id: pattern_hero + library: null + disable_css: false + entity_classes: all_classes + settings: + pattern: + field_templates: default + variant: default + regions: + hero_image: + - su_banner_image + hero_super_headline: + - su_banner_sup_header + hero_body: + - su_banner_header + - su_banner_body + - su_banner_button +id: paragraph.stanford_top_banner.default +targetEntityType: paragraph +bundle: stanford_top_banner +mode: default +content: + su_banner_body: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 3 + region: hero_body + su_banner_button: + type: link + label: hidden + settings: + trim_length: null + url_only: false + url_plain: false + rel: '0' + target: '0' + third_party_settings: + empty_fields: + handler: '' + field_formatter_class: + class: '' + weight: 4 + region: hero_body + su_banner_header: + type: entity_title_heading + label: hidden + settings: + tag: h1 + linked: false + third_party_settings: + empty_fields: + handler: '' + field_formatter_class: + class: '' + weight: 2 + region: hero_body + su_banner_image: + type: media_responsive_image_formatter + label: hidden + settings: + view_mode: default + link: false + image_style: stanford_hero_block_wide + remove_alt: 0 + third_party_settings: + empty_fields: + handler: '' + field_formatter_class: + class: '' + weight: 0 + region: hero_image + su_banner_sup_header: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 1 + region: hero_super_headline +hidden: + search_api_excerpt: true diff --git a/config/sync/core.entity_view_display.paragraph.stanford_top_banner.variant_1.yml b/config/sync/core.entity_view_display.paragraph.stanford_top_banner.variant_1.yml new file mode 100644 index 000000000..077c8d387 --- /dev/null +++ b/config/sync/core.entity_view_display.paragraph.stanford_top_banner.variant_1.yml @@ -0,0 +1,39 @@ +uuid: 7e6155a8-4062-4894-9e8e-f673b4eb7e01 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.paragraph.variant_1 + - field.field.paragraph.stanford_top_banner.su_banner_body + - field.field.paragraph.stanford_top_banner.su_banner_button + - field.field.paragraph.stanford_top_banner.su_banner_header + - field.field.paragraph.stanford_top_banner.su_banner_image + - field.field.paragraph.stanford_top_banner.su_banner_sup_header + - paragraphs.paragraphs_type.stanford_top_banner + module: + - field_formatter_class + - stanford_media +id: paragraph.stanford_top_banner.variant_1 +targetEntityType: paragraph +bundle: stanford_top_banner +mode: variant_1 +content: + su_banner_image: + type: media_responsive_image_formatter + label: hidden + settings: + view_mode: default + link: false + image_style: card_2_1 + remove_alt: false + third_party_settings: + field_formatter_class: + class: '' + weight: 0 + region: content +hidden: + search_api_excerpt: true + su_banner_body: true + su_banner_button: true + su_banner_header: true + su_banner_sup_header: true diff --git a/config/sync/field.field.node.stanford_page.su_page_banner.yml b/config/sync/field.field.node.stanford_page.su_page_banner.yml index 7663f185a..4065a805d 100644 --- a/config/sync/field.field.node.stanford_page.su_page_banner.yml +++ b/config/sync/field.field.node.stanford_page.su_page_banner.yml @@ -6,6 +6,7 @@ dependencies: - field.storage.node.su_page_banner - node.type.stanford_page - paragraphs.paragraphs_type.stanford_banner + - paragraphs.paragraphs_type.stanford_top_banner module: - entity_reference_revisions id: node.stanford_page.su_page_banner @@ -22,16 +23,47 @@ settings: handler: 'default:paragraph' handler_settings: target_bundles: + stanford_top_banner: stanford_top_banner stanford_banner: stanford_banner negate: 0 target_bundles_drag_drop: + stanford_accordion: + weight: -23 + enabled: false stanford_banner: - weight: 4 + weight: -26 enabled: true stanford_card: - weight: 5 + weight: -25 + enabled: false + stanford_entity: + weight: -22 + enabled: false + stanford_gallery: + weight: -21 + enabled: false + stanford_layout: + weight: -20 + enabled: false + stanford_lists: + weight: -19 enabled: false + stanford_media_caption: + weight: -18 + enabled: false + stanford_person_cta: + weight: -17 + enabled: false + stanford_schedule: + weight: -16 + enabled: false + stanford_spacer: + weight: -15 + enabled: false + stanford_top_banner: + weight: -27 + enabled: true stanford_wysiwyg: - weight: 6 + weight: -24 enabled: false field_type: entity_reference_revisions diff --git a/config/sync/field.field.paragraph.stanford_top_banner.su_banner_body.yml b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_body.yml new file mode 100644 index 000000000..0c9e81f41 --- /dev/null +++ b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_body.yml @@ -0,0 +1,24 @@ +uuid: c6db971b-1811-453c-a85d-dfd57c6cc677 +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.su_banner_body + - filter.format.stanford_minimal_html + - paragraphs.paragraphs_type.stanford_top_banner + module: + - text +id: paragraph.stanford_top_banner.su_banner_body +field_name: su_banner_body +entity_type: paragraph +bundle: stanford_top_banner +label: Body +description: 'The main content area for the banner. Shows up in an opaque box over the image. ' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + allowed_formats: + - stanford_minimal_html +field_type: text_long diff --git a/config/sync/field.field.paragraph.stanford_top_banner.su_banner_button.yml b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_button.yml new file mode 100644 index 000000000..b75cfd58a --- /dev/null +++ b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_button.yml @@ -0,0 +1,23 @@ +uuid: c004e7d3-2fa2-4cf0-8495-4d24ef1b82c5 +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.su_banner_button + - paragraphs.paragraphs_type.stanford_top_banner + module: + - link +id: paragraph.stanford_top_banner.su_banner_button +field_name: su_banner_button +entity_type: paragraph +bundle: stanford_top_banner +label: Button +description: 'A call to action link that shows up below the main body content.' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + title: 2 + link_type: 17 +field_type: link diff --git a/config/sync/field.field.paragraph.stanford_top_banner.su_banner_header.yml b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_header.yml new file mode 100644 index 000000000..415f6cb81 --- /dev/null +++ b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_header.yml @@ -0,0 +1,19 @@ +uuid: 1a49b356-3910-464d-9b75-b249de260583 +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.su_banner_header + - paragraphs.paragraphs_type.stanford_top_banner +id: paragraph.stanford_top_banner.su_banner_header +field_name: su_banner_header +entity_type: paragraph +bundle: stanford_top_banner +label: Headline +description: 'The main headline. This shows up large.' +required: true +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/config/sync/field.field.paragraph.stanford_top_banner.su_banner_image.yml b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_image.yml new file mode 100644 index 000000000..ca8e9343b --- /dev/null +++ b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_image.yml @@ -0,0 +1,29 @@ +uuid: 1e8bac2f-7e20-41e4-8c89-4f1ba211691b +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.su_banner_image + - media.type.image + - paragraphs.paragraphs_type.stanford_top_banner +id: paragraph.stanford_top_banner.su_banner_image +field_name: su_banner_image +entity_type: paragraph +bundle: stanford_top_banner +label: Image +description: 'The banner background image. Please use hi-resolution images.' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:media' + handler_settings: + target_bundles: + image: image + sort: + field: _none + direction: ASC + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/config/sync/field.field.paragraph.stanford_top_banner.su_banner_sup_header.yml b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_sup_header.yml new file mode 100644 index 000000000..ebb34866d --- /dev/null +++ b/config/sync/field.field.paragraph.stanford_top_banner.su_banner_sup_header.yml @@ -0,0 +1,19 @@ +uuid: b1e1f65b-d41f-46f4-bc8f-c259214e020f +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.su_banner_sup_header + - paragraphs.paragraphs_type.stanford_top_banner +id: paragraph.stanford_top_banner.su_banner_sup_header +field_name: su_banner_sup_header +entity_type: paragraph +bundle: stanford_top_banner +label: Superhead +description: 'Smaller heading above the main headline' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/config/sync/paragraphs.paragraphs_type.stanford_top_banner.yml b/config/sync/paragraphs.paragraphs_type.stanford_top_banner.yml new file mode 100644 index 000000000..406c222d6 --- /dev/null +++ b/config/sync/paragraphs.paragraphs_type.stanford_top_banner.yml @@ -0,0 +1,10 @@ +uuid: f1ceb6bd-3d54-4a33-8657-aed4e13ee51b +langcode: en +status: true +dependencies: { } +id: stanford_top_banner +label: 'Top Banner' +icon_uuid: null +icon_default: null +description: '' +behavior_plugins: { } diff --git a/stanford_profile.profile b/stanford_profile.profile index fc4aeb009..fed066557 100644 --- a/stanford_profile.profile +++ b/stanford_profile.profile @@ -36,3 +36,28 @@ function stanford_profile_config_pages_presave(ConfigPages $config_page) { \Drupal::service('router.builder')->rebuild(); } } + +/** + * Implements hook_entity_field_access(). + */ +function stanford_profile_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, \Drupal\Core\Session\AccountInterface $account, \Drupal\Core\Field\FieldItemListInterface $items = NULL) { + if ( + $field_definition->getName() == 'title' && + $items?->getEntity() instanceof \Drupal\node\NodeInterface && + $items?->getEntity()->bundle() == 'stanford_page' && + $items?->getEntity()->get('su_page_banner')->count() + ) { + $banner_id = $items->getEntity() + ->get('su_page_banner') + ->get(0) + ->get('target_id') + ->getString(); + + $top_banner = \Drupal::entityTYpeManager() + ->getStorage('paragraph') + ->load($banner_id); + + return \Drupal\Core\Access\AccessResult::forbiddenIf($top_banner?->bundle() == 'stanford_top_banner' && $operation == 'view'); + } + return \Drupal\Core\Access\AccessResult::neutral(); +}