Add a field for text alignment
This commit is contained in:
parent
fb3b58cf97
commit
c816e90e06
7 changed files with 82 additions and 5 deletions
|
@ -5,6 +5,7 @@ dependencies:
|
|||
config:
|
||||
- block_content.type.basic
|
||||
- field.field.block_content.basic.body
|
||||
- field.field.block_content.basic.field_text_alignment
|
||||
module:
|
||||
- text
|
||||
_core:
|
||||
|
@ -24,6 +25,12 @@ content:
|
|||
placeholder: ''
|
||||
show_summary: false
|
||||
third_party_settings: { }
|
||||
field_text_alignment:
|
||||
type: options_select
|
||||
weight: 26
|
||||
region: content
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
info:
|
||||
type: string_textfield
|
||||
weight: -5
|
||||
|
|
|
@ -5,7 +5,9 @@ dependencies:
|
|||
config:
|
||||
- block_content.type.basic
|
||||
- field.field.block_content.basic.body
|
||||
- field.field.block_content.basic.field_text_alignment
|
||||
module:
|
||||
- options
|
||||
- text
|
||||
_core:
|
||||
default_config_hash: hBNNDTFwakREOTa6GGMqN899Iyrii0hInwSJtQ7Kj30
|
||||
|
@ -21,4 +23,11 @@ content:
|
|||
third_party_settings: { }
|
||||
weight: 0
|
||||
region: content
|
||||
field_text_alignment:
|
||||
type: list_default
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
weight: 1
|
||||
region: content
|
||||
hidden: { }
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
uuid: 452b60fa-6916-4432-9b04-f9a2c8e58485
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- block_content.type.basic
|
||||
- field.storage.block_content.field_text_alignment
|
||||
module:
|
||||
- options
|
||||
id: block_content.basic.field_text_alignment
|
||||
field_name: field_text_alignment
|
||||
entity_type: block_content
|
||||
bundle: basic
|
||||
label: 'Text alignment'
|
||||
description: ''
|
||||
required: true
|
||||
translatable: false
|
||||
default_value:
|
||||
-
|
||||
value: left
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: list_string
|
|
@ -0,0 +1,27 @@
|
|||
uuid: 6deb7b46-7e0a-44da-9702-c78688cbca6e
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- block_content
|
||||
- options
|
||||
id: block_content.field_text_alignment
|
||||
field_name: field_text_alignment
|
||||
entity_type: block_content
|
||||
type: list_string
|
||||
settings:
|
||||
allowed_values:
|
||||
-
|
||||
value: left
|
||||
label: Left
|
||||
-
|
||||
value: centre
|
||||
label: Centre
|
||||
allowed_values_function: ''
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -34,7 +34,7 @@
|
|||
],
|
||||
"changed": [
|
||||
{
|
||||
"value": "2025-07-03T15:11:02+00:00"
|
||||
"value": "2025-07-03T17:08:44+00:00"
|
||||
}
|
||||
],
|
||||
"reusable": [
|
||||
|
@ -59,5 +59,10 @@
|
|||
"processed": "<p>Not sure? <a href=\"http:\/\/localhost:8888\/archive\">Browse the archive \u2192<\/a><\/p>\n",
|
||||
"summary": ""
|
||||
}
|
||||
],
|
||||
"field_text_alignment": [
|
||||
{
|
||||
"value": "centre"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
],
|
||||
"revision_timestamp": [
|
||||
{
|
||||
"value": "2025-07-03T16:12:47+00:00"
|
||||
"value": "2025-07-03T17:08:44+00:00"
|
||||
}
|
||||
],
|
||||
"revision_uid": [
|
||||
|
@ -51,7 +51,7 @@
|
|||
],
|
||||
"changed": [
|
||||
{
|
||||
"value": "2025-07-03T16:12:47+00:00"
|
||||
"value": "2025-07-03T17:08:44+00:00"
|
||||
}
|
||||
],
|
||||
"promote": [
|
||||
|
|
|
@ -28,7 +28,13 @@
|
|||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
<div{{ attributes }}>
|
||||
{% set text_alignment = content.field_text_alignment['#items'].getValue()|first.value %}
|
||||
|
||||
{% set classes = [
|
||||
text_alignment is same as 'centre' ? 'flex justify-center',
|
||||
] %}
|
||||
|
||||
<div{{ attributes.addClass(classes) }}>
|
||||
{{ title_prefix }}
|
||||
|
||||
{% if label %}
|
||||
|
@ -38,6 +44,6 @@
|
|||
{{ title_suffix }}
|
||||
|
||||
{% block content %}
|
||||
{{ content }}
|
||||
{{ content|without('field_text_alignment') }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue