diff --git a/config/sync/core.entity_view_display.node.document.highlighted.yml b/config/sync/core.entity_view_display.node.document.highlighted.yml new file mode 100644 index 0000000000..f81fd9db23 --- /dev/null +++ b/config/sync/core.entity_view_display.node.document.highlighted.yml @@ -0,0 +1,137 @@ +uuid: 5fbb7f17-0be8-4c70-8a5c-ceb806015a8f +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.highlighted + - field.field.node.document.body + - field.field.node.document.field_comments + - field.field.node.document.field_document_logo + - field.field.node.document.field_document_publication_date + - field.field.node.document.field_document_spatial_coverage + - field.field.node.document.field_file + - field.field.node.document.field_keywords + - field.field.node.document.field_licence + - field.field.node.document.field_shared_in + - field.field.node.document.field_short_title + - field.field.node.document.field_site_featured + - field.field.node.document.field_state + - field.field.node.document.field_topic + - field.field.node.document.field_type + - field.field.node.document.og_audience + - node.type.document + - responsive_image.styles.highlighted_solution + module: + - field_delimiter + - field_formatter_range + - field_group + - 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 + parent_name: '' + weight: 5 + format_type: html_element + format_settings: + id: '' + classes: '' + element: div + show_label: true + label_element: h3 + attributes: '' + effect: none + speed: fast + label: Categorisation + region: hidden + group_attachment: + children: + - field_file + parent_name: '' + weight: 7 + format_type: html_element + format_settings: + id: '' + classes: '' + element: div + show_label: true + label_element: h3 + attributes: '' + effect: none + speed: fast + label: Attachment + region: hidden + layout_builder: + allow_custom: false + enabled: false +_core: + default_config_hash: IBVftmfYLkfapLokxuyLrv1me4toJj5yidZu0ixGxQM +id: node.document.highlighted +targetEntityType: node +bundle: document +mode: highlighted +content: + body: + label: hidden + type: text_trimmed + weight: 2 + settings: + trim_length: 200 + third_party_settings: + template_suggestion: + template_suggestion: '' + region: content + field_document_logo: + type: responsive_image + weight: 0 + region: content + label: hidden + settings: + responsive_image_style: highlighted_solution + image_link: '' + 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: '' +hidden: + field_comments: true + field_document_publication_date: true + field_document_spatial_coverage: true + field_file: true + field_keywords: true + field_licence: true + field_shared_in: true + field_short_title: true + field_site_featured: true + field_state: true + field_type: true + langcode: true + links: true + og_audience: true + published_at: true + read_more: true + report: true + share_link: true 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 f6d4961202..29c176c20b 100644 --- a/config/sync/core.entity_view_display.node.event.highlighted.yml +++ b/config/sync/core.entity_view_display.node.event.highlighted.yml @@ -27,9 +27,13 @@ dependencies: - field.field.node.event.field_topic - field.field.node.event.og_audience - node.type.event + - responsive_image.styles.highlighted_solution module: - - joinup_core + - field_delimiter + - field_formatter_range - layout_builder + - responsive_image + - smart_trim - template_suggestion - user third_party_settings: @@ -41,29 +45,61 @@ targetEntityType: node bundle: event mode: highlighted content: - field_event_date: + body: + type: smart_trim + 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: '' + field_event_logo: + type: responsive_image weight: 0 + region: content label: hidden settings: - timezone_override: '' - separator: to - default_format: d/m/Y - day_diff_format: d - month_diff_format: d/m - year_diff_format: d/m/Y + responsive_image_style: highlighted_solution + image_link: '' third_party_settings: template_suggestion: template_suggestion: '' - type: daterange_condensed + 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: '' hidden: - body: true field_attachment: true field_comments: true field_event_agenda: true field_event_contact_email: true field_event_coordinates: true - field_event_logo: true + field_event_date: true field_event_online_location: true field_event_spatial_coverage: true field_event_web_url: true @@ -76,7 +112,6 @@ hidden: field_short_title: true field_site_featured: true field_state: true - field_topic: true langcode: true links: true og_audience: true diff --git a/config/sync/core.entity_view_display.node.event.highlighted_event.yml b/config/sync/core.entity_view_display.node.event.highlighted_event.yml new file mode 100644 index 0000000000..dfd008cb06 --- /dev/null +++ b/config/sync/core.entity_view_display.node.event.highlighted_event.yml @@ -0,0 +1,86 @@ +uuid: c8a8b7b3-2996-4276-81e9-f8ca6a274733 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.highlighted_event + - field.field.node.event.body + - field.field.node.event.field_attachment + - field.field.node.event.field_comments + - field.field.node.event.field_event_agenda + - field.field.node.event.field_event_contact_email + - field.field.node.event.field_event_coordinates + - field.field.node.event.field_event_date + - field.field.node.event.field_event_logo + - field.field.node.event.field_event_online_location + - field.field.node.event.field_event_spatial_coverage + - field.field.node.event.field_event_web_url + - field.field.node.event.field_keywords + - field.field.node.event.field_location + - field.field.node.event.field_organisation + - field.field.node.event.field_organisation_type + - field.field.node.event.field_scope + - field.field.node.event.field_shared_in + - field.field.node.event.field_short_title + - field.field.node.event.field_site_featured + - field.field.node.event.field_state + - field.field.node.event.field_topic + - field.field.node.event.og_audience + - node.type.event + module: + - joinup_core + - layout_builder + - template_suggestion + - user +third_party_settings: + layout_builder: + allow_custom: false + enabled: false +id: node.event.highlighted_event +targetEntityType: node +bundle: event +mode: highlighted_event +content: + field_event_date: + weight: 0 + label: hidden + settings: + timezone_override: '' + separator: to + default_format: d/m/Y + day_diff_format: d + month_diff_format: d/m + year_diff_format: d/m/Y + third_party_settings: + template_suggestion: + template_suggestion: '' + type: daterange_condensed + region: content +hidden: + body: true + field_attachment: true + field_comments: true + field_event_agenda: true + field_event_contact_email: true + field_event_coordinates: true + field_event_logo: true + field_event_online_location: true + field_event_spatial_coverage: true + field_event_web_url: true + field_keywords: true + field_location: true + field_organisation: true + field_organisation_type: true + field_scope: true + field_shared_in: true + field_short_title: true + field_site_featured: true + field_state: true + field_topic: true + langcode: true + links: true + og_audience: true + published_at: true + read_more: true + report: true + share_link: true diff --git a/config/sync/core.entity_view_display.node.news.highlighted.yml b/config/sync/core.entity_view_display.node.news.highlighted.yml new file mode 100644 index 0000000000..43a918bb58 --- /dev/null +++ b/config/sync/core.entity_view_display.node.news.highlighted.yml @@ -0,0 +1,124 @@ +uuid: 31b72862-7d67-46f5-8bb4-798fe4a2818c +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.highlighted + - field.field.node.news.body + - field.field.node.news.field_attachment + - field.field.node.news.field_comments + - field.field.node.news.field_keywords + - field.field.node.news.field_news_headline + - field.field.node.news.field_news_logo + - field.field.node.news.field_news_referenced_solution + - field.field.node.news.field_news_source_url + - field.field.node.news.field_news_spatial_coverage + - field.field.node.news.field_shared_in + - field.field.node.news.field_site_featured + - field.field.node.news.field_state + - field.field.node.news.field_topic + - field.field.node.news.og_audience + - node.type.news + - 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_references: + children: + - field_news_source_url + parent_name: '' + weight: 19 + format_type: html_element + format_settings: + id: '' + classes: '' + element: div + show_label: true + label_element: h3 + attributes: '' + effect: none + speed: fast + label: References + region: hidden + layout_builder: + allow_custom: false + enabled: false +id: node.news.highlighted +targetEntityType: node +bundle: news +mode: highlighted +content: + body: + label: hidden + type: smart_trim + 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: '' + region: content + field_news_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: '' +hidden: + field_attachment: true + field_comments: true + field_keywords: true + field_news_headline: true + field_news_referenced_solution: true + field_news_source_url: true + field_news_spatial_coverage: true + field_shared_in: true + field_site_featured: true + field_state: true + langcode: true + links: true + og_audience: true + published_at: true + read_more: true + report: true + share_link: true diff --git a/config/sync/core.entity_view_mode.node.highlighted_event.yml b/config/sync/core.entity_view_mode.node.highlighted_event.yml new file mode 100644 index 0000000000..eb158adab9 --- /dev/null +++ b/config/sync/core.entity_view_mode.node.highlighted_event.yml @@ -0,0 +1,10 @@ +uuid: f0f4ebec-5d74-4af5-8676-7c741149ec6d +langcode: en +status: true +dependencies: + module: + - node +id: node.highlighted_event +label: 'Highlighted event' +targetEntityType: node +cache: true diff --git a/config/sync/entityqueue.entity_queue.highlighted_solution.yml b/config/sync/entityqueue.entity_queue.highlighted_content.yml similarity index 58% rename from config/sync/entityqueue.entity_queue.highlighted_solution.yml rename to config/sync/entityqueue.entity_queue.highlighted_content.yml index 2a3d23b081..aa33fe70db 100644 --- a/config/sync/entityqueue.entity_queue.highlighted_solution.yml +++ b/config/sync/entityqueue.entity_queue.highlighted_content.yml @@ -1,24 +1,25 @@ -uuid: c40d0c80-bf7c-4f00-831e-b77871742309 +uuid: d51790d4-39e1-4b51-b2f3-9f9621ff06e6 langcode: en status: true dependencies: module: - - rdf_entity -id: highlighted_solution + - node +id: highlighted_content label: 'Highlighted content' handler: simple handler_configuration: { } entity_settings: - target_type: rdf_entity - handler: 'default:rdf_entity' + target_type: node + handler: 'default:node' handler_settings: target_bundles: - collection: collection - solution: solution + document: document + event: event + news: news sort: field: _none auto_create: false - auto_create_bundle: '' + auto_create_bundle: event queue_settings: min_size: 1 max_size: 1 diff --git a/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml b/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml index 39b2ffe9c7..fb4f561dae 100644 --- a/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml +++ b/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml @@ -31,18 +31,18 @@ variant_settings: context_mapping: { } additional: { } weight: 0 - 204e8ccb-280d-4ee4-b598-74b9f96d6496: - uuid: 204e8ccb-280d-4ee4-b598-74b9f96d6496 + 7807ee72-f98e-46bb-80d9-fe1d2b6cd8de: + uuid: 7807ee72-f98e-46bb-80d9-fe1d2b6cd8de region: second configuration: - id: 'entityqueue_block:highlighted_solution' + id: 'entityqueue_block:highlighted_content' label: 'Highlighted content' provider: entityqueue_block label_display: visible view_mode: highlighted context_mapping: { } additional: { } - weight: 0 + weight: 1 third_party_settings: { } - layout_id: joinup_layout_twocol_60_40 @@ -70,7 +70,7 @@ variant_settings: label: 'Highlighted event' provider: entityqueue_block label_display: visible - view_mode: highlighted + view_mode: highlighted_event context_mapping: { } additional: { } weight: 0 diff --git a/tests/behat.yml.dist b/tests/behat.yml.dist index 3f3d20e746..17479748ae 100644 --- a/tests/behat.yml.dist +++ b/tests/behat.yml.dist @@ -113,7 +113,7 @@ default: Header menu: '#block-joinup-theme-main-menu' Header: '.section--featured, .section-header' Highlighted event: '.block-entityqueue--highlighted-event' - Highlighted content: '.block-entityqueue--highlighted-solution' + Highlighted content: '.block-entityqueue--highlighted-content' In the spotlight: '.block-views-blockin-the-spotlight-block' Left sidebar: '.section--sidebar-left' Main solution vertical tab: '#edit-group-main' diff --git a/tests/features/homepage.feature b/tests/features/homepage.feature index 967b3f3c2a..390a32766c 100644 --- a/tests/features/homepage.feature +++ b/tests/features/homepage.feature @@ -90,25 +90,72 @@ Feature: Homepage | 3 | alan.jpg | HR, Statistics and Analysis | Microgravity | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | @terms - Scenario: A solution can be highlighted on the homepage - Given solution: - | title | Mercury poisoning | - | state | validated | - | description | Mercury poisoning is a type of metal poisoning due to exposure to mercury. | - | logo | logo.png | - | solution type | Interoperability Specification, Networking Service | - | topic | Demography, EU and European Policies, HR | - | state | validated | + Scenario: A document can be highlighted on the homepage + Given collection: + | title | Clash of document's | + | state | validated | + And document content: + | title | collection | topic | state | logo | body | + | Microgravity | Clash of document's | HR, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + | Alliens | Clash of document's | Statistics and Analysis, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + | Groundforce | Clash of document's | Statistics and Analysis, E-justice | proposed | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + And the "Highlighted content" content listing contains: + | type | label | + | document | Alliens | + + When I am on the homepage + Then I should see "Alliens" as the Highlighted content + And I should see the link "Related content" + When I click "Related content" + Then I should be on the advanced search page + And the "Document" content checkbox item should be selected + And I should see the "Alliens" tile + And I should not see the "Microgravity" tile + And I should not see the "Groundforce" tile + + @terms + Scenario: A news can be highlighted on the homepage + Given collection: + | title | Clash of new's | + | state | validated | + And news content: + | title | headline | collection | topic | state | publication date | body | + | Some title | Some headline | Clash of new's | E-justice | validated | 2021-04-26T19:09:00Z | Body | + | Internet medicine | It cures virtually everything | Clash of new's | E-health Dpt. | validated | 2014-02-22T19:26:57Z | Electronic healthcare | And the "Highlighted content" content listing contains: - | type | label | - | solution | Mercury poisoning | + | type | label | + | news | Some title | When I am on the homepage - Then I should see "Mercury poisoning" as the Highlighted content + Then I should see "Some title" as the Highlighted content And I should see the link "Related content" When I click "Related content" Then I should be on the advanced search page - And the "Solution" content checkbox item should be selected + And the "News" content checkbox item should be selected + And I should see the "Some title" tile + And I should not see the "Internet medicine" tile + + @terms + Scenario: A event can be highlighted on the homepage + Given collection: + | title | Clash of event's | + | state | validated | + Given event content: + | title | collection | topic | state | logo | body | + | Lisbon steak festival | Clash of event's | E-justice | validated | charles.jpg | Two groups of mice (six per group) were housed aboard the International Space Station for 35 days. One group was subjected to artificial gravity (1 g) and the other to microgravity. | + | Oeiras steak festival | Clash of event's | EU and European Policies | validated | charles.jpg | Two groups of mice (six per group) were housed aboard the International Space Station for 35 days. One group was subjected to artificial gravity (1 g) and the other to microgravity. | + And the "Highlighted content" content listing contains: + | type | label | + | event | Lisbon steak festival | + + When I am on the homepage + Then I should see "Lisbon steak festival" as the Highlighted content + And I should see the link "Related content" + When I click "Related content" + Then I should be on the advanced search page + And the "Event" content checkbox item should be selected + And I should see the "Lisbon steak festival" tile + And I should not see the "Oeiras steak festival" tile Scenario: An event can be highlighted on the homepage Given event content: diff --git a/tests/src/Context/SolutionContext.php b/tests/src/Context/SolutionContext.php index ce7e778b56..1cef54e331 100644 --- a/tests/src/Context/SolutionContext.php +++ b/tests/src/Context/SolutionContext.php @@ -856,17 +856,18 @@ public function setDownloadCountForEntity(string $type, string $target_entity_la * * @Then I should see :label as the Highlighted content */ - public function assertHighlightedSolution(string $label): void { - $solution = self::getSolutionByName($label); + public function assertHighlightedContent(string $label): void { + /** @var \Drupal\custom_page\Entity\CustomPageInterface $content */ + $content = self::getNodeByTitle($label); - $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-solution'); + $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-content'); // Check block title. $actual_block_title = $block_element->find('css', 'h2')->getText(); Assert::assertEquals('Highlighted content', $actual_block_title, sprintf('Expected the Highlighted content block to have the title "Highlighted content" but instead found "%s".', $actual_block_title)); // Check that the logo is present. - if ($logo = $solution->getLogoAsFile()) { + if ($logo = $content->getLogoAsFile()) { $filename = $logo->getFilename(); $logo_is_present = self::hasImage($filename, $block_element); Assert::assertTrue($logo_is_present, sprintf('Image with filename "%s" has been found in the Highlighted content block.', $filename)); @@ -874,15 +875,15 @@ public function assertHighlightedSolution(string $label): void { // Check title text. $actual_title = $block_element->find('css', 'article h2')->getText(); - Assert::assertEquals($solution->label(), $actual_title, sprintf('Expected the Highlighted content to have the title "%s" but instead found "%s".', $solution->label(), $actual_title)); + Assert::assertEquals($content->label(), $actual_title, sprintf('Expected the Highlighted content to have the title "%s" but instead found "%s".', $content->label(), $actual_title)); // Check that title links to the canonical page of the solution. - $xpath = '//h2/a[@href = "' . $solution->toUrl()->toString() . '"]'; - Assert::assertNotEmpty($block_element->find('xpath', $xpath), sprintf('Solution "%s" does not link to the canonical page.', $actual_title)); + $xpath = '//h2/a[@href = "' . $content->toUrl()->toString() . '"]'; + Assert::assertNotEmpty($block_element->find('xpath', $xpath), sprintf('%s "%s" does not link to the canonical page.', $content->getType(), $actual_title)); // Retrieve the topics from the solution, limiting the result to maximum 2 // topics. - $topics = array_slice($solution->getTopics(), 0, 2); + $topics = array_slice($content->getTopics(), 0, 2); // Check that the correct number of topics are present. $topic_elements = $block_element->findAll('css', '.field--name-field-topic .field__item'); @@ -902,7 +903,7 @@ public function assertHighlightedSolution(string $label): void { } // Check that the description is present. - $actual_description = $block_element->find('css', '.field--name-field-is-description')->getText(); + $actual_description = $block_element->find('css', '.field--name-body')->getText(); Assert::assertNotEmpty($actual_description); } diff --git a/web/modules/custom/joinup_event/joinup_event.module b/web/modules/custom/joinup_event/joinup_event.module index 24142e7306..ab90e1016a 100644 --- a/web/modules/custom/joinup_event/joinup_event.module +++ b/web/modules/custom/joinup_event/joinup_event.module @@ -57,9 +57,9 @@ function joinup_event_entity_type_alter(array &$entity_types): void { function joinup_event_theme($existing, $type, $theme, $path) { return [ // Use a custom template for the highlighted event on the homepage. - 'node__event__highlighted' => [ + 'node__event__highlighted_event' => [ 'base hook' => 'node', - 'template' => 'node--event--highlighted', + 'template' => 'node--event--highlighted-event', ], ]; } @@ -67,7 +67,7 @@ function joinup_event_theme($existing, $type, $theme, $path) { /** * Prepares variables for the highlighted event template. * - * Default template: node--event--highlighted.html.twig. + * Default template: node--event--highlighted-event.html.twig. * * The highlighted event is displayed on the homepage and is managed through an * entityqueue. It has a number of additional fields (header text and a call to @@ -81,7 +81,7 @@ function joinup_event_theme($existing, $type, $theme, $path) { * @see hook_entity_type_build() * @see \Drupal\Core\Field\BaseFieldDefinition::setDisplayConfigurable() */ -function template_preprocess_node__event__highlighted(array &$variables) { +function joinup_event_preprocess_node__event__highlighted_event(array &$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['node']; diff --git a/web/modules/custom/joinup_event/templates/node--event--highlighted.html.twig b/web/modules/custom/joinup_event/templates/node--event--highlighted-event.html.twig similarity index 100% rename from web/modules/custom/joinup_event/templates/node--event--highlighted.html.twig rename to web/modules/custom/joinup_event/templates/node--event--highlighted-event.html.twig diff --git a/web/themes/ventuno/src/scss/components/_highlighted-solution-block.scss b/web/themes/ventuno/src/scss/components/_highlighted-content-block.scss similarity index 92% rename from web/themes/ventuno/src/scss/components/_highlighted-solution-block.scss rename to web/themes/ventuno/src/scss/components/_highlighted-content-block.scss index ae10fd3edb..ac84de06ee 100644 --- a/web/themes/ventuno/src/scss/components/_highlighted-solution-block.scss +++ b/web/themes/ventuno/src/scss/components/_highlighted-content-block.scss @@ -1,5 +1,5 @@ -// Highlighted Solution -.block-entityqueue--highlighted-solution { +// Highlighted Content +.block-entityqueue--highlighted-content { @extend .pb-5; border-bottom: 1px solid rgba($primary, .1); position: relative; @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/web/themes/ventuno/src/scss/components/_homepage.scss b/web/themes/ventuno/src/scss/components/_homepage.scss index 4c41c34a14..0d40ae4a51 100644 --- a/web/themes/ventuno/src/scss/components/_homepage.scss +++ b/web/themes/ventuno/src/scss/components/_homepage.scss @@ -21,7 +21,7 @@ } } .view-in-the-spotlight, -.block-entityqueue--highlighted-solution, +.block-entityqueue--highlighted-content, .view-latest-news { .views-row { @extend .mb-4; diff --git a/web/themes/ventuno/src/scss/homepage.scss b/web/themes/ventuno/src/scss/homepage.scss index 0791e76be8..83a2a2d566 100644 --- a/web/themes/ventuno/src/scss/homepage.scss +++ b/web/themes/ventuno/src/scss/homepage.scss @@ -15,7 +15,7 @@ @import "components/in-the-spotlight-block"; @import "components/latest-news-block"; @import "components/navbar"; -@import "components/highlighted-solution-block"; +@import "components/highlighted-content-block"; @import "components/highlighted-event-block"; @import "components/global-search-block"; @import "components/explore-block"; diff --git a/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig b/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig similarity index 100% rename from web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig rename to web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig diff --git a/web/themes/ventuno/templates/content/node--document--highlighted.html.twig b/web/themes/ventuno/templates/content/node--document--highlighted.html.twig new file mode 100644 index 0000000000..596930ee58 --- /dev/null +++ b/web/themes/ventuno/templates/content/node--document--highlighted.html.twig @@ -0,0 +1,18 @@ +{# +/** + * @file + * Themeing for document node highlighted. + */ +#} + + {{ content.field_document_logo }} + {{ content.field_topic }} + {{ title_prefix }} + {% if not page and not is_label_hidden %} + + {{ label }} + + {% endif %} + {{ title_suffix }} + {{ content|without('field_document_logo', 'field_topic') }} + diff --git a/web/themes/ventuno/templates/content/node--event--highlighted.html.twig b/web/themes/ventuno/templates/content/node--event--highlighted.html.twig new file mode 100644 index 0000000000..0ee66e2854 --- /dev/null +++ b/web/themes/ventuno/templates/content/node--event--highlighted.html.twig @@ -0,0 +1,18 @@ +{# +/** + * @file + * Themeing for event node highlighted. + */ +#} + + {{ content.field_event_logo }} + {{ content.field_topic }} + {{ title_prefix }} + {% if not page and not is_label_hidden %} + + {{ label }} + + {% endif %} + {{ title_suffix }} + {{ content|without('field_event_logo', 'field_topic') }} + diff --git a/web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig b/web/themes/ventuno/templates/content/node--news--highlighted.html.twig similarity index 68% rename from web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig rename to web/themes/ventuno/templates/content/node--news--highlighted.html.twig index fbf1ed495b..600cc3d604 100644 --- a/web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig +++ b/web/themes/ventuno/templates/content/node--news--highlighted.html.twig @@ -1,11 +1,11 @@ {# /** * @file - * Themeing for rdf entities. + * Themeing for news node highlighted. */ #} - {{ content.field_ar_logo }} + {{ content.field_news_logo }} {{ content.field_topic }} {{ title_prefix }} {% if not page and not is_label_hidden %} @@ -14,5 +14,5 @@ {% endif %} {{ title_suffix }} - {{ content|without('field_ar_logo', 'field_topic') }} + {{ content|without('field_news_logo', 'field_topic') }} diff --git a/web/themes/ventuno/ventuno.theme b/web/themes/ventuno/ventuno.theme index 2333750f8c..0e59e8445d 100644 --- a/web/themes/ventuno/ventuno.theme +++ b/web/themes/ventuno/ventuno.theme @@ -141,19 +141,20 @@ function ventuno_preprocess_page(&$variables) { * Implements hook_preprocess_block(). */ function ventuno_preprocess_block(&$variables) { - if ($variables['derivative_plugin_id'] == 'highlighted_solution') { + if ($variables['derivative_plugin_id'] == 'highlighted_content') { + if (isset($variables['elements']['content']['entities'][0])) { - /** @var \Drupal\rdf_entity\RdfInterface $entity */ - $entity = $variables['elements']['content']['entities'][0]['#rdf_entity']; + /** @var \Drupal\node\NodeInterface $node */ + $node = $variables['elements']['content']['entities'][0]['#node']; - $topics = $entity->get('field_topic')->getValue(); + $topics = $node->get('field_topic')->getValue(); $options = [ 'query' => [ 'f' => [ - 'type:' . $entity->bundle(), + 'type:' . $node->bundle(), 'topic:' . reset($topics)["target_id"], ], ],