From 903d77c5f41cc6958e296874ebe7536cff1390c5 Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Wed, 8 May 2024 13:48:38 +0200 Subject: [PATCH 1/3] 1289: Template and styling for files paragraph --- .../assets/css/hoeringsportal.scss | 1 + .../assets/css/module/_paragraph-files.scss | 14 ++++++++++++++ .../paragraph/paragraph--files.html.twig | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 web/themes/custom/hoeringsportal/assets/css/module/_paragraph-files.scss create mode 100644 web/themes/custom/hoeringsportal/templates/paragraph/paragraph--files.html.twig diff --git a/web/themes/custom/hoeringsportal/assets/css/hoeringsportal.scss b/web/themes/custom/hoeringsportal/assets/css/hoeringsportal.scss index 191e9897..301e2888 100755 --- a/web/themes/custom/hoeringsportal/assets/css/hoeringsportal.scss +++ b/web/themes/custom/hoeringsportal/assets/css/hoeringsportal.scss @@ -29,6 +29,7 @@ "module/signup", "module/list", "module/pager", + "module/paragraph-files", "module/info_box", "module/search", "module/newsletter", diff --git a/web/themes/custom/hoeringsportal/assets/css/module/_paragraph-files.scss b/web/themes/custom/hoeringsportal/assets/css/module/_paragraph-files.scss new file mode 100644 index 00000000..e5b1b491 --- /dev/null +++ b/web/themes/custom/hoeringsportal/assets/css/module/_paragraph-files.scss @@ -0,0 +1,14 @@ +.paragraph-files article { + background-color: $color-petroleum-100; + padding: $spacer; + margin-bottom: calc($spacer * 0.25); + display: flex; +} + +.paragraph-files article svg { + order: 1; +} + +.paragraph-files article span { + order: 2; +} diff --git a/web/themes/custom/hoeringsportal/templates/paragraph/paragraph--files.html.twig b/web/themes/custom/hoeringsportal/templates/paragraph/paragraph--files.html.twig new file mode 100644 index 00000000..7aa29291 --- /dev/null +++ b/web/themes/custom/hoeringsportal/templates/paragraph/paragraph--files.html.twig @@ -0,0 +1,18 @@ +{# Paragraph for exposing downloadable files #} + +
+
+
+ {% block paragraph %} + {% if content.field_title['#items'] is not empty %} +

{{ content.field_title }}

+ {% endif %} + {% block content %} +
+ {{ content|without('field_title') }} +
+ {% endblock %} + {% endblock paragraph %} +
+
+
From b3fa0fc6073139f12655ea16c1ecc1eb5a570861 Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Wed, 8 May 2024 13:48:59 +0200 Subject: [PATCH 2/3] 1289: Drupal configuraiton for files paragraph --- ...y_form_display.paragraph.files.default.yml | 34 +++++++++++++++++++ ...y_view_display.paragraph.files.default.yml | 31 +++++++++++++++++ ...oject_main_page.field_content_sections.yml | 5 +++ ...de.project_page.field_content_sections.yml | 5 +++ ...ield.field.paragraph.files.field_files.yml | 31 +++++++++++++++++ ...ield.field.paragraph.files.field_title.yml | 19 +++++++++++ .../field.storage.paragraph.field_files.yml | 20 +++++++++++ .../sync/paragraphs.paragraphs_type.files.yml | 10 ++++++ 8 files changed, 155 insertions(+) create mode 100644 config/sync/core.entity_form_display.paragraph.files.default.yml create mode 100644 config/sync/core.entity_view_display.paragraph.files.default.yml create mode 100644 config/sync/field.field.paragraph.files.field_files.yml create mode 100644 config/sync/field.field.paragraph.files.field_title.yml create mode 100644 config/sync/field.storage.paragraph.field_files.yml create mode 100644 config/sync/paragraphs.paragraphs_type.files.yml diff --git a/config/sync/core.entity_form_display.paragraph.files.default.yml b/config/sync/core.entity_form_display.paragraph.files.default.yml new file mode 100644 index 00000000..8d36c620 --- /dev/null +++ b/config/sync/core.entity_form_display.paragraph.files.default.yml @@ -0,0 +1,34 @@ +uuid: 458df720-e0e0-4169-bdcb-c3b73826dfaf +langcode: da +status: true +dependencies: + config: + - field.field.paragraph.files.field_files + - field.field.paragraph.files.field_title + - paragraphs.paragraphs_type.files +id: paragraph.files.default +targetEntityType: paragraph +bundle: files +mode: default +content: + field_files: + type: entity_reference_autocomplete + weight: 1 + region: content + settings: + match_operator: CONTAINS + match_limit: 10 + size: 60 + placeholder: '' + third_party_settings: { } + field_title: + type: string_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } +hidden: + created: true + status: true diff --git a/config/sync/core.entity_view_display.paragraph.files.default.yml b/config/sync/core.entity_view_display.paragraph.files.default.yml new file mode 100644 index 00000000..600a24f1 --- /dev/null +++ b/config/sync/core.entity_view_display.paragraph.files.default.yml @@ -0,0 +1,31 @@ +uuid: 007ebc45-761d-4581-bec4-1a3746342f72 +langcode: da +status: true +dependencies: + config: + - field.field.paragraph.files.field_files + - field.field.paragraph.files.field_title + - paragraphs.paragraphs_type.files +id: paragraph.files.default +targetEntityType: paragraph +bundle: files +mode: default +content: + field_files: + type: entity_reference_entity_view + label: hidden + settings: + view_mode: material_display + link: false + third_party_settings: { } + weight: 1 + region: content + field_title: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: { } diff --git a/config/sync/field.field.node.project_main_page.field_content_sections.yml b/config/sync/field.field.node.project_main_page.field_content_sections.yml index 2480295f..4b13a51c 100644 --- a/config/sync/field.field.node.project_main_page.field_content_sections.yml +++ b/config/sync/field.field.node.project_main_page.field_content_sections.yml @@ -6,6 +6,7 @@ dependencies: - field.storage.node.field_content_sections - node.type.project_main_page - paragraphs.paragraphs_type.content_block + - paragraphs.paragraphs_type.files - paragraphs.paragraphs_type.image - paragraphs.paragraphs_type.info_box - paragraphs.paragraphs_type.introduction @@ -35,6 +36,7 @@ settings: info_box: info_box introduction: introduction teaser_row: teaser_row + files: files negate: 0 target_bundles_drag_drop: content_block: @@ -43,6 +45,9 @@ settings: content_list: weight: -20 enabled: false + files: + weight: 13 + enabled: true image: weight: -22 enabled: true diff --git a/config/sync/field.field.node.project_page.field_content_sections.yml b/config/sync/field.field.node.project_page.field_content_sections.yml index aeebb8ed..790d11ba 100644 --- a/config/sync/field.field.node.project_page.field_content_sections.yml +++ b/config/sync/field.field.node.project_page.field_content_sections.yml @@ -6,6 +6,7 @@ dependencies: - field.storage.node.field_content_sections - node.type.project_page - paragraphs.paragraphs_type.content_block + - paragraphs.paragraphs_type.files - paragraphs.paragraphs_type.image - paragraphs.paragraphs_type.info_box - paragraphs.paragraphs_type.introduction @@ -34,6 +35,7 @@ settings: info_box: info_box introduction: introduction teaser_row: teaser_row + files: files text_aside_blocks_2_column: text_aside_blocks_2_column negate: 0 target_bundles_drag_drop: @@ -43,6 +45,9 @@ settings: content_list: weight: -18 enabled: false + files: + weight: 13 + enabled: true image: weight: -20 enabled: true diff --git a/config/sync/field.field.paragraph.files.field_files.yml b/config/sync/field.field.paragraph.files.field_files.yml new file mode 100644 index 00000000..05ed935c --- /dev/null +++ b/config/sync/field.field.paragraph.files.field_files.yml @@ -0,0 +1,31 @@ +uuid: 6ea32cf8-12f7-4989-b7c0-b3c6fe0f5887 +langcode: da +status: true +dependencies: + config: + - field.storage.paragraph.field_files + - media.type.document + - media.type.image + - paragraphs.paragraphs_type.files +id: paragraph.files.field_files +field_name: field_files +entity_type: paragraph +bundle: files +label: Files +description: 'Used to reference the files' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:media' + handler_settings: + target_bundles: + image: image + document: document + sort: + field: _none + direction: ASC + auto_create: false + auto_create_bundle: image +field_type: entity_reference diff --git a/config/sync/field.field.paragraph.files.field_title.yml b/config/sync/field.field.paragraph.files.field_title.yml new file mode 100644 index 00000000..b13860a9 --- /dev/null +++ b/config/sync/field.field.paragraph.files.field_title.yml @@ -0,0 +1,19 @@ +uuid: 57f24aa7-0238-4330-8266-f6c9e9307704 +langcode: da +status: true +dependencies: + config: + - field.storage.paragraph.field_title + - paragraphs.paragraphs_type.files +id: paragraph.files.field_title +field_name: field_title +entity_type: paragraph +bundle: files +label: Title +description: 'Used for the title' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/config/sync/field.storage.paragraph.field_files.yml b/config/sync/field.storage.paragraph.field_files.yml new file mode 100644 index 00000000..a6d90d81 --- /dev/null +++ b/config/sync/field.storage.paragraph.field_files.yml @@ -0,0 +1,20 @@ +uuid: b3aa2101-054f-4c60-821b-3b39df4efe02 +langcode: da +status: true +dependencies: + module: + - media + - paragraphs +id: paragraph.field_files +field_name: field_files +entity_type: paragraph +type: entity_reference +settings: + target_type: media +module: core +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/sync/paragraphs.paragraphs_type.files.yml b/config/sync/paragraphs.paragraphs_type.files.yml new file mode 100644 index 00000000..0a714625 --- /dev/null +++ b/config/sync/paragraphs.paragraphs_type.files.yml @@ -0,0 +1,10 @@ +uuid: 50378b6f-ed0f-41ae-98af-1afa956943b0 +langcode: da +status: true +dependencies: { } +id: files +label: Files +icon_uuid: null +icon_default: null +description: 'Used to upload files that the user can download' +behavior_plugins: { } From 56b518cca681e8c149303ecd9c24f60d78141b8c Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Wed, 8 May 2024 14:20:12 +0200 Subject: [PATCH 3/3] 1289: Changelog update --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c9444a..49d20b9d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,11 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +* [PR-405](https://github.com/itk-dev/hoeringsportal/pull/405) + Add paragraph for files + ## [4.3.0] - 2024-04-29 -* [PR-402](https://github.com/itk-dev/hoeringsportal/pull/402) - Project list filters: remove categories * [PR-395](https://github.com/itk-dev/hoeringsportal/pull/395) Project fixtures * [PR-398](https://github.com/itk-dev/hoeringsportal/pull/398)