From 52e2f0d9904f14aaee1777a162cd5e47f98b2b10 Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Wed, 27 Oct 2021 01:11:39 +0100 Subject: [PATCH] ISAICP-6765: Rename image style and fix text style. --- ...view_display.node.document.highlighted.yml | 12 +- ...ty_view_display.node.event.highlighted.yml | 19 +-- ...ity_view_display.node.news.highlighted.yml | 19 +-- ...play.rdf_entity.collection.highlighted.yml | 148 ------------------ ...isplay.rdf_entity.solution.highlighted.yml | 4 +- ...sive_image.styles.highlighted_content.yml} | 4 +- config/sync/user.role.moderator.yml | 1 - ...queue-block--highlighted-content.html.twig | 4 +- web/themes/ventuno/ventuno.theme | 38 ++--- 9 files changed, 41 insertions(+), 208 deletions(-) delete mode 100644 config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml rename config/sync/{responsive_image.styles.highlighted_solution.yml => responsive_image.styles.highlighted_content.yml} (97%) diff --git a/config/sync/core.entity_view_display.node.document.highlighted.yml b/config/sync/core.entity_view_display.node.document.highlighted.yml index f81fd9db23..66ef808670 100644 --- a/config/sync/core.entity_view_display.node.document.highlighted.yml +++ b/config/sync/core.entity_view_display.node.document.highlighted.yml @@ -20,24 +20,24 @@ dependencies: - field.field.node.document.field_type - field.field.node.document.og_audience - node.type.document - - responsive_image.styles.highlighted_solution + - responsive_image.styles.highlighted_content module: - field_delimiter - field_formatter_range - field_group + - joinup_html_stripper - layout_builder - responsive_image - template_suggestion - - text - user third_party_settings: field_group: group_categorisation: children: - - field_short_title - - field_type - field_document_publication_date - field_licence + - field_short_title + - field_type parent_name: '' weight: 5 format_type: html_element @@ -81,7 +81,7 @@ mode: highlighted content: body: label: hidden - type: text_trimmed + type: joinup_html_stripper_stripped weight: 2 settings: trim_length: 200 @@ -95,7 +95,7 @@ content: region: content label: hidden settings: - responsive_image_style: highlighted_solution + responsive_image_style: highlighted_content image_link: '' third_party_settings: template_suggestion: diff --git a/config/sync/core.entity_view_display.node.event.highlighted.yml b/config/sync/core.entity_view_display.node.event.highlighted.yml index 29c176c20b..fc54593a34 100644 --- a/config/sync/core.entity_view_display.node.event.highlighted.yml +++ b/config/sync/core.entity_view_display.node.event.highlighted.yml @@ -27,13 +27,13 @@ dependencies: - field.field.node.event.field_topic - field.field.node.event.og_audience - node.type.event - - responsive_image.styles.highlighted_solution + - responsive_image.styles.highlighted_content module: - field_delimiter - field_formatter_range + - joinup_html_stripper - layout_builder - responsive_image - - smart_trim - template_suggestion - user third_party_settings: @@ -46,23 +46,12 @@ bundle: event mode: highlighted content: body: - type: smart_trim + type: joinup_html_stripper_stripped weight: 2 region: content label: hidden settings: trim_length: 200 - trim_type: chars - trim_suffix: '' - wrap_class: trimmed - more_text: More - more_class: more-link - summary_handler: full - wrap_output: false - more_link: false - trim_options: - text: false - trim_zero: false third_party_settings: template_suggestion: template_suggestion: '' @@ -72,7 +61,7 @@ content: region: content label: hidden settings: - responsive_image_style: highlighted_solution + responsive_image_style: highlighted_content image_link: '' third_party_settings: template_suggestion: diff --git a/config/sync/core.entity_view_display.node.news.highlighted.yml b/config/sync/core.entity_view_display.node.news.highlighted.yml index 43a918bb58..ebfb4a0c3c 100644 --- a/config/sync/core.entity_view_display.node.news.highlighted.yml +++ b/config/sync/core.entity_view_display.node.news.highlighted.yml @@ -19,14 +19,14 @@ dependencies: - field.field.node.news.field_topic - field.field.node.news.og_audience - node.type.news - - responsive_image.styles.highlighted_solution + - responsive_image.styles.highlighted_content module: - field_delimiter - field_formatter_range - field_group + - joinup_html_stripper - layout_builder - responsive_image - - smart_trim - template_suggestion - user third_party_settings: @@ -58,21 +58,10 @@ mode: highlighted content: body: label: hidden - type: smart_trim + type: joinup_html_stripper_stripped weight: 2 settings: trim_length: 200 - trim_type: chars - trim_suffix: '' - wrap_class: trimmed - more_text: More - more_class: more-link - summary_handler: full - wrap_output: false - more_link: false - trim_options: - text: false - trim_zero: false third_party_settings: template_suggestion: template_suggestion: '' @@ -83,7 +72,7 @@ content: region: content label: hidden settings: - responsive_image_style: highlighted_solution + responsive_image_style: highlighted_content image_link: content third_party_settings: template_suggestion: diff --git a/config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml b/config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml deleted file mode 100644 index ab1bdc1e71..0000000000 --- a/config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml +++ /dev/null @@ -1,148 +0,0 @@ -uuid: 651f0d88-0d69-41c1-a40c-908655d164bc -langcode: en -status: true -dependencies: - config: - - core.entity_view_mode.rdf_entity.highlighted - - field.field.rdf_entity.collection.field_ar_abstract - - field.field.rdf_entity.collection.field_ar_access_url - - field.field.rdf_entity.collection.field_ar_affiliates - - field.field.rdf_entity.collection.field_ar_banner - - field.field.rdf_entity.collection.field_ar_closed - - field.field.rdf_entity.collection.field_ar_contact_information - - field.field.rdf_entity.collection.field_ar_content_creation - - field.field.rdf_entity.collection.field_ar_description - - field.field.rdf_entity.collection.field_ar_logo - - field.field.rdf_entity.collection.field_ar_moderation - - field.field.rdf_entity.collection.field_ar_owner - - field.field.rdf_entity.collection.field_ar_state - - field.field.rdf_entity.collection.field_collection_content - - field.field.rdf_entity.collection.field_keywords - - field.field.rdf_entity.collection.field_newsletter - - field.field.rdf_entity.collection.field_short_id - - field.field.rdf_entity.collection.field_site_featured - - field.field.rdf_entity.collection.field_spatial_coverage - - field.field.rdf_entity.collection.field_topic - - rdf_entity.rdfentity.collection - - responsive_image.styles.highlighted_solution - module: - - field_delimiter - - field_formatter_range - - field_group - - layout_builder - - responsive_image - - smart_trim - - template_suggestion - - user -third_party_settings: - field_group: - group_abstract_wrapper: - children: - - field_ar_abstract - - read_more - parent_name: '' - weight: 4 - format_type: html_element - format_settings: - element: div - show_label: false - label_element: h3 - attributes: '' - effect: none - speed: fast - id: '' - classes: '' - label: 'Abstract wrapper' - region: hidden - layout_builder: - allow_custom: false - enabled: false -id: rdf_entity.collection.highlighted -targetEntityType: rdf_entity -bundle: collection -mode: highlighted -content: - field_ar_description: - type: smart_trim - weight: 3 - region: content - label: hidden - settings: - trim_length: 200 - trim_type: chars - trim_suffix: … - wrap_class: trimmed - more_text: More - more_class: more-link - trim_options: - text: true - trim_zero: false - wrap_output: false - more_link: false - summary_handler: full - third_party_settings: - template_suggestion: - template_suggestion: '' - field_ar_logo: - type: responsive_image - weight: 0 - region: content - label: hidden - settings: - responsive_image_style: highlighted_solution - image_link: content - third_party_settings: - template_suggestion: - template_suggestion: '' - field_topic: - type: entity_reference_label - weight: 1 - region: content - label: hidden - settings: - link: true - third_party_settings: - field_delimiter: - delimiter: '' - field_formatter_range: - order: 0 - limit: 2 - offset: 0 - template_suggestion: - template_suggestion: '' - label: - label: hidden - type: string - weight: 2 - settings: - link_to_entity: false - third_party_settings: { } - region: content -hidden: - changed: true - created: true - field_ar_abstract: true - field_ar_access_url: true - field_ar_affiliates: true - field_ar_banner: true - field_ar_closed: true - field_ar_contact_information: true - field_ar_content_creation: true - field_ar_moderation: true - field_ar_owner: true - field_ar_state: true - field_collection_content: true - field_keywords: true - field_newsletter: true - field_short_id: true - field_site_featured: true - field_spatial_coverage: true - join_collection: true - langcode: true - last_update: true - members: true - og_group: true - rdf_entity_field_collection_content_inline_facets: true - rdf_entity_field_collection_content_top: true - read_more: true - solutions: true diff --git a/config/sync/core.entity_view_display.rdf_entity.solution.highlighted.yml b/config/sync/core.entity_view_display.rdf_entity.solution.highlighted.yml index 91de51cfd7..0a97ebf82a 100644 --- a/config/sync/core.entity_view_display.rdf_entity.solution.highlighted.yml +++ b/config/sync/core.entity_view_display.rdf_entity.solution.highlighted.yml @@ -46,7 +46,7 @@ dependencies: - field.field.rdf_entity.solution.field_status - field.field.rdf_entity.solution.field_topic - rdf_entity.rdfentity.solution - - responsive_image.styles.highlighted_solution + - responsive_image.styles.highlighted_content module: - field_delimiter - field_formatter_range @@ -109,7 +109,7 @@ content: region: content label: hidden settings: - responsive_image_style: highlighted_solution + responsive_image_style: highlighted_content image_link: content third_party_settings: template_suggestion: diff --git a/config/sync/responsive_image.styles.highlighted_solution.yml b/config/sync/responsive_image.styles.highlighted_content.yml similarity index 97% rename from config/sync/responsive_image.styles.highlighted_solution.yml rename to config/sync/responsive_image.styles.highlighted_content.yml index 7cc3d325a9..11351d344b 100644 --- a/config/sync/responsive_image.styles.highlighted_solution.yml +++ b/config/sync/responsive_image.styles.highlighted_content.yml @@ -20,8 +20,8 @@ dependencies: - image.style.xxl_col_5_2x theme: - ventuno -id: highlighted_solution -label: 'Highlighted solution' +id: highlighted_content +label: 'Highlighted content' image_style_mappings: - breakpoint_id: ventuno.xl diff --git a/config/sync/user.role.moderator.yml b/config/sync/user.role.moderator.yml index 1ee384b2bb..3604caae0e 100644 --- a/config/sync/user.role.moderator.yml +++ b/config/sync/user.role.moderator.yml @@ -234,7 +234,6 @@ permissions: - 'update discover_topics entityqueue' - 'update highlighted_content entityqueue' - 'update highlighted_event entityqueue' - - 'update highlighted_solution entityqueue' - 'update paragraph content iframe' - 'update paragraph content json_map' - 'update site alerts' diff --git a/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig b/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig index 7a1557127e..aafac3d953 100644 --- a/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig +++ b/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig @@ -41,7 +41,9 @@ {% endif %} {{ title_suffix }} {% block content %} - {{ related_content }} + {% if related_content %} + {{ related_content }} + {% endif %} {{ content }} {% endblock %} diff --git a/web/themes/ventuno/ventuno.theme b/web/themes/ventuno/ventuno.theme index 0e59e8445d..50d301e092 100644 --- a/web/themes/ventuno/ventuno.theme +++ b/web/themes/ventuno/ventuno.theme @@ -15,6 +15,7 @@ use Drupal\joinup_bundle_class\LogoInterface; use Drupal\joinup_collection\JoinupCollectionHelper; use Drupal\rdf_entity\Entity\Rdf; use Drupal\smart_trim\Truncate\TruncateHTML; +use Drupal\topic\Entity\TopicReferencingEntityInterface; /** * Implements hook_theme_suggestions_HOOK_alter(). @@ -147,26 +148,27 @@ function ventuno_preprocess_block(&$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['elements']['content']['entities'][0]['#node']; - $topics = $node->get('field_topic')->getValue(); - - $options = [ - 'query' => - [ - 'f' => + $topics = $node instanceof TopicReferencingEntityInterface ? $node->getTopics() : []; + if ($topics) { + $options = [ + 'query' => [ - 'type:' . $node->bundle(), - 'topic:' . reset($topics)["target_id"], + 'f' => + [ + 'type:' . $node->bundle(), + 'topic:' . reset($topics)["target_id"], + ], + ], + ]; + $variables['related_content'] = [ + '#type' => 'link', + '#title' => t('Related content'), + '#url' => Url::fromRoute('view.search.page_1', [], $options), + '#attributes' => [ + 'class' => ['more-link'], ], - ], - ]; - $variables['related_content'] = [ - '#type' => 'link', - '#title' => t('Related content'), - '#url' => Url::fromRoute('view.search.page_1', [], $options), - '#attributes' => [ - 'class' => ['more-link'], - ], - ]; + ]; + } } } }