Skip to content
Snippets Groups Projects
Commit f7388846 authored by Stephen Mustgrave's avatar Stephen Mustgrave
Browse files

Resolve #3414112 "Summary box"

parent 9e003166
No related branches found
No related tags found
1 merge request!4Resolve #3414112 "Summary box"
Pipeline #78367 passed
Showing
with 237 additions and 0 deletions
# UI Suite USWDS Paragraphs Alert
## Recommended settings
After installing recommend configuring allowed text formats at
`admin/structure/paragraphs_type/ui_suite_uswds_summary_box/fields/paragraph.ui_suite_uswds_summary_box.field_summary_box_content` and
`admin/structure/paragraphs_type/ui_suite_uswds_summary_box/fields/paragraph.ui_suite_uswds_summary_box.field_summary_box_heading`
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.ui_suite_uswds_summary_box.field_summary_box_content
- field.field.paragraph.ui_suite_uswds_summary_box.field_summary_box_heading
- paragraphs.paragraphs_type.ui_suite_uswds_summary_box
module:
- text
id: paragraph.ui_suite_uswds_summary_box.default
targetEntityType: paragraph
bundle: ui_suite_uswds_summary_box
mode: default
content:
field_summary_box_content:
type: text_textarea
weight: 1
region: content
settings:
rows: 5
placeholder: ''
third_party_settings: { }
field_summary_box_heading:
type: text_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
hidden:
created: true
status: true
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.ui_suite_uswds_summary_box.field_summary_box_content
- field.field.paragraph.ui_suite_uswds_summary_box.field_summary_box_heading
- paragraphs.paragraphs_type.ui_suite_uswds_summary_box
module:
- text
id: paragraph.ui_suite_uswds_summary_box.default
targetEntityType: paragraph
bundle: ui_suite_uswds_summary_box
mode: default
content:
field_summary_box_content:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 1
region: content
field_summary_box_heading:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 0
region: content
hidden: { }
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.field_summary_box_content
- paragraphs.paragraphs_type.ui_suite_uswds_summary_box
module:
- text
id: paragraph.ui_suite_uswds_summary_box.field_summary_box_content
field_name: field_summary_box_content
entity_type: paragraph
bundle: ui_suite_uswds_summary_box
label: Content
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
allowed_formats: { }
field_type: text_long
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.field_summary_box_heading
- paragraphs.paragraphs_type.ui_suite_uswds_summary_box
module:
- text
id: paragraph.ui_suite_uswds_summary_box.field_summary_box_heading
field_name: field_summary_box_heading
entity_type: paragraph
bundle: ui_suite_uswds_summary_box
label: Heading
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
allowed_formats: { }
field_type: text
langcode: en
status: true
dependencies:
module:
- paragraphs
- text
id: paragraph.field_summary_box_content
field_name: field_summary_box_content
entity_type: paragraph
type: text_long
settings: { }
module: text
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
langcode: en
status: true
dependencies:
module:
- paragraphs
- text
id: paragraph.field_summary_box_heading
field_name: field_summary_box_heading
entity_type: paragraph
type: text
settings:
max_length: 255
module: text
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
langcode: en
status: true
dependencies: { }
id: ui_suite_uswds_summary_box
label: 'Summary Box'
icon_uuid: null
icon_default: null
description: 'Based off of <a href="https://designsystem.digital.gov/components/summary-box/">USWDS Summary Box</a>'
behavior_plugins: { }
{#
/**
* @file
* Default theme implementation to display a paragraph.
*
* Available variables:
* - paragraph: Full paragraph entity.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - paragraph.getCreatedTime() will return the paragraph creation timestamp.
* - paragraph.id(): The paragraph ID.
* - paragraph.bundle(): The type of the paragraph, for example, "image" or "text".
* - paragraph.getOwnerId(): The user ID of the paragraph author.
* See Drupal\paragraphs\Entity\Paragraph for a full list of public properties
* and methods for the paragraph object.
* - content: All paragraph items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - paragraphs: The current template type (also known as a "theming hook").
* - paragraphs--type-[type]: The current paragraphs type. For example, if the paragraph is an
* "Image" it would result in "paragraphs--type--image". Note that the machine
* name will often be in a short form of the human readable label.
* - paragraphs--view-mode--[view_mode]: The View Mode of the paragraph; for example, a
* preview would result in: "paragraphs--view-mode--preview", and
* default: "paragraphs--view-mode--default".
* - view_mode: View mode; for example, "preview" or "full".
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* @see template_preprocess_paragraph()
*
* @ingroup themeable
*/
#}
{%
set classes = [
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
not paragraph.isPublished() ? 'paragraph--unpublished'
]
%}
{{ pattern('summary_box', {
'attributes': attributes.addClass(classes),
'summary_heading': content.field_summary_box_heading ? content.field_summary_box_heading.0 : '',
'content': content.field_summary_box_content,
}) }}
name: UI Suite USWDS Paragaphs Summary Box
type: module
description: Summary box using UI Suite USWDS
core_version_requirement: ^10
package: UI Suite USWDS
dependencies:
- paragraphs:paragraphs
- ui_suite_uswds_paragraphs:ui_suite_uswds_paragraphs
<?php
/**
* @file
* UI Suite USWDS Paragraphs Summary box file.
*/
/**
* Implements hook_theme().
*/
function ui_suite_uswds_paragraphs_summary_box_theme($existing, $type, $theme, $path): array {
return [
'paragraph__ui_suite_uswds_summary_box' => [
'base hook' => 'paragraph',
'path' => $path . '/templates',
],
];
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment