Skip to content

Commit

Permalink
feat(YALB-1496): Change address field to textarea, hide admin section…
Browse files Browse the repository at this point in the history
…s for regular sections
  • Loading branch information
codechefmarc committed Aug 1, 2023
1 parent 2c4df47 commit 3c36a98
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
- field.field.node.profile.layout_builder__layout
- node.type.profile
module:
- address
- allowed_formats
- field_group
- maxlength
Expand Down Expand Up @@ -68,10 +67,12 @@ bundle: profile
mode: default
content:
field_address:
type: address_default
type: text_textarea
weight: 19
region: content
settings: { }
settings:
rows: 5
placeholder: ''
third_party_settings: { }
field_affiliation:
type: options_select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,24 @@ third_party_settings:
entity_view_mode_restriction:
allowed_layouts:
- layout_onecol
- ys_layout_banner
- ys_layout_two_column
- ys_layout_page_meta
denylisted_blocks: { }
allowlisted_blocks: { }
restricted_categories: { }
entity_view_mode_restriction_by_region:
allowed_layouts:
- layout_onecol
- ys_layout_banner
- ys_layout_two_column
- ys_layout_page_meta
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:
'Inline blocks':
Expand All @@ -111,8 +111,8 @@ third_party_settings:
'Inline blocks':
- 'inline_block:text'
restricted_categories:
ys_layout_banner:
all_regions:
ys_layout_two_column:
content:
- 'Chaos Tools'
- 'Content fields'
- 'Custom block types'
Expand All @@ -124,11 +124,72 @@ third_party_settings:
- System
- Webform
- 'YaleSites Core'
- 'YaleSites Layouts'
- 'YaleSites alert'
- core
ys_layout_two_column:
sidebar:
- 'Chaos Tools'
- 'Content fields'
- 'Custom block types'
- Devel
- Forms
- Help
- 'Lists (Views)'
- Menus
- System
- Webform
- 'YaleSites Core'
- 'YaleSites Layouts'
- '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 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.default
targetEntityType: node
bundle: page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
- field.field.node.profile.layout_builder__layout
- node.type.profile
module:
- address
- layout_builder
- layout_builder_restrictions
- metatag
Expand Down Expand Up @@ -98,7 +97,6 @@ third_party_settings:
entity_view_mode_restriction:
allowed_layouts:
- layout_onecol
- ys_layout_banner
- ys_layout_two_column
denylisted_blocks: { }
allowlisted_blocks:
Expand All @@ -122,17 +120,12 @@ third_party_settings:
entity_view_mode_restriction_by_region:
allowed_layouts:
- layout_onecol
- ys_layout_banner
- ys_layout_two_column
allowlisted_blocks:
layout_onecol:
all_regions:
'YaleSites Layouts':
- profile_contact_block
ys_layout_banner:
all_regions:
'YaleSites Layouts':
- profile_meta_block
ys_layout_two_column:
content:
'Inline blocks':
Expand Down Expand Up @@ -197,29 +190,13 @@ third_party_settings:
- 'YaleSites Core'
- 'YaleSites alert'
- core
ys_layout_banner:
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.profile.default
targetEntityType: node
bundle: profile
mode: default
content:
field_address:
type: address_default
type: text_default
label: above
settings: { }
third_party_settings: { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
uuid: dd54a6d3-80ab-4cbc-a5de-0ba5d116765c
uuid: fc091409-edbc-4be1-932b-a96221f72d61
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_address
- node.type.profile
module:
- address
- allowed_formats
- text
third_party_settings:
allowed_formats:
allowed_formats:
- heading_html
id: node.profile.field_address
field_name: field_address
entity_type: node
Expand All @@ -15,47 +20,7 @@ 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: { }
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
settings: { }
field_type: text_long
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
uuid: b6c01928-faee-46a6-a157-21c784bb7b37
uuid: 731900c3-bc43-42ae-82d3-9eea30af0ab0
langcode: en
status: true
dependencies:
module:
- address
- node
- text
id: node.field_address
field_name: field_address
entity_type: node
type: address
type: text_long
settings: { }
module: address
module: text
locked: false
cardinality: 1
translatable: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugin_config:
entity_view_mode_restriction:
enabled: true
weight: 1
entity_view_mode_restriction_by_region:
enabled: true
weight: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
retain_restrictions_after_layout_removal: '1'
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function build() {
// 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;
$address = ($node->field_address->first()) ? $node->field_address->first()->getValue()['value'] : NULL;

return [
'#theme' => 'ys_profile_contact_block',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,11 @@
link__url: 'tel:' ~ phone,
link__content: phone,
} %}
{% endembed %}
{% endembed %}
{% endif %}

{% if address %}

{% set address %}
<br>
{% if address.address_line1 %}
{{ address.address_line1 }}<br>
{% endif %}
{% if address.address_line2 %}
{{ address.address_line2 }}<br>
{% endif %}
{% 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'
Expand Down

0 comments on commit 3c36a98

Please sign in to comment.