Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic ewpp 1360 news v3 #957

Merged
merged 33 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
510ca40
EWPP-1362: Update PublicationDate extra field in order to be used by …
22Alexandra Jul 31, 2021
469c7a3
EWPP-1362: Use PublicationDate extra field to display Last update fie…
22Alexandra Jul 31, 2021
46dea81
EWPP-1362: Update test coverage.
22Alexandra Jul 31, 2021
8369a15
Merge pull request #901 from openeuropa/EWPP-1362
22Alexandra Aug 5, 2021
80ed112
EWPP-1363: Style Sources field in full view mode.
22Alexandra Aug 2, 2021
191b1b2
EWPP-1363: Update test coverage.
22Alexandra Aug 3, 2021
c008eab
Merge pull request #903 from openeuropa/EWPP-1363
22Alexandra Aug 5, 2021
eba9ca0
EWPP-1367: Add related departments field to news.
nagyad Aug 6, 2021
c9558db
EWPP-1367: Fix comment.
nagyad Aug 9, 2021
0040e11
EWPP-1367: Override the singular department label.
nagyad Aug 9, 2021
9eb0cb3
Merge pull request #910 from openeuropa/EWPP-1367
nagyad Aug 11, 2021
fb9251d
EWPP-1388: Add optional icon parameter to list item pattern.
22Alexandra Aug 8, 2021
4dcf524
EWPP-1388: Use list item pattern to render Sources field of News CT.
22Alexandra Aug 8, 2021
75e9ccd
EWPP-1388: Add icon to template only when available.
22Alexandra Aug 10, 2021
7509566
EWPP-1388: Update list item pattern assertions.
22Alexandra Aug 11, 2021
aec3fb6
EWPP-1388: Add icon only to Source links.
22Alexandra Aug 11, 2021
e07b1d8
Merge pull request #913 from openeuropa/EWPP-1388
22Alexandra Aug 13, 2021
81b5a3d
EWPP-1368: Merge branch '3.x' into update-News-v3.
22Alexandra Aug 14, 2021
0bf2df5
Merge pull request #920 from openeuropa/update-News-v3
22Alexandra Aug 16, 2021
b3086f9
EWPP-1368: Merge branch '3.x' into update-News-v3-epic.
22Alexandra Aug 17, 2021
5bf038f
Merge pull request #922 from openeuropa/update-News-v3-epic
22Alexandra Aug 17, 2021
f9f3e2b
EWPP-1362: Reorganise publication date extra field class.
nagyad Aug 31, 2021
f06d3f7
Merge pull request #933 from openeuropa/EWPP-1362-2
yenyasinn Aug 31, 2021
fec7b0b
Merge branch '3.x' of github.com:openeuropa/oe_theme into EWPP-1360-u…
nagyad Sep 2, 2021
b78f168
Merge pull request #936 from openeuropa/EWPP-1360-update
nagyad Sep 2, 2021
e63773e
EWPP-1368: Update Sources and Related links fields rendering.
22Alexandra Aug 19, 2021
9ce9eaf
EWPP-1368: Fix margin and padding of fields on news content type.
sergepavle Aug 30, 2021
fdeb0ca
EWPP-1368: Fix functional tests.
sergepavle Aug 30, 2021
1a5ebbe
EWPP-1368: Adapt tests to the latest template changes.
nagyad Sep 1, 2021
18d7637
Merge pull request #924 from openeuropa/EWPP-1368
upchuk Sep 24, 2021
d42f83c
EWPP-0000: Merge branch '3.x' into update-EPIC-News.
22Alexandra Sep 24, 2021
ec7c416
EWPP-0000: Update oe_content version.
22Alexandra Sep 24, 2021
f178eda
Merge pull request #956 from openeuropa/update-EPIC-News
upchuk Sep 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
XDEBUG_MODE: "develop, debug"
PHP_IDE_CONFIG: "serverName=Docker"
# Enable step debugging for all PHP request. See ./README.md#step-debugging for more information.
XDEBUG_SESSION: 1
# XDEBUG_SESSION: 1
mysql:
image: percona/percona-server:5.7
command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.full
- field.field.node.oe_news.body
- field.field.node.oe_news.oe_author
- field.field.node.oe_news.oe_departments
- field.field.node.oe_news.oe_news_contacts
- field.field.node.oe_news.oe_news_featured_media
- field.field.node.oe_news.oe_news_last_updated
- field.field.node.oe_news.oe_news_location
- field.field.node.oe_news.oe_news_sources
- field.field.node.oe_news.oe_news_types
- field.field.node.oe_news.oe_publication_date
- field.field.node.oe_news.oe_reference_code
Expand All @@ -16,7 +20,6 @@ dependencies:
- field.field.node.oe_news.oe_teaser
- node.type.oe_news
module:
- datetime
- entity_reference_revisions
- field_group
- link
Expand All @@ -28,11 +31,12 @@ third_party_settings:
group_details:
children:
- oe_reference_code
- oe_publication_date
- extra_field_oe_theme_content_news_date
- oe_author
- oe_departments
- oe_news_location
parent_name: ''
weight: 1
weight: 3
format_type: oe_theme_helper_field_list_pattern
region: content
format_settings:
Expand All @@ -50,14 +54,10 @@ content:
settings: { }
third_party_settings: { }
region: content
oe_news_contacts:
type: entity_reference_revisions_entity_view
weight: 2
extra_field_oe_theme_content_news_date:
weight: 13
region: content
label: above
settings:
view_mode: full
link: ''
settings: { }
third_party_settings: { }
oe_author:
type: skos_concept_entity_reference_label
Expand All @@ -67,22 +67,42 @@ content:
settings:
link: false
third_party_settings: { }
oe_news_location:
oe_departments:
type: skos_concept_entity_reference_label
weight: 15
region: content
label: above
settings:
link: false
third_party_settings: { }
oe_publication_date:
type: datetime_default
weight: 13
oe_news_contacts:
type: entity_reference_revisions_entity_view
weight: 4
region: content
label: above
settings:
timezone_override: ''
format_type: oe_theme_news_date
view_mode: full
link: ''
third_party_settings: { }
oe_news_location:
type: skos_concept_entity_reference_label
weight: 16
region: content
label: above
settings:
link: false
third_party_settings: { }
oe_news_sources:
type: link
weight: 1
region: content
label: hidden
settings:
trim_length: null
url_only: false
url_plain: false
rel: '0'
target: '0'
third_party_settings: { }
oe_reference_code:
type: string
Expand All @@ -94,7 +114,7 @@ content:
third_party_settings: { }
oe_related_links:
type: link
weight: 3
weight: 5
region: content
label: hidden
settings:
Expand All @@ -113,7 +133,9 @@ hidden:
oe_content_navigation_title: true
oe_content_short_title: true
oe_news_featured_media: true
oe_news_last_updated: true
oe_news_types: true
oe_publication_date: true
oe_subject: true
oe_summary: true
oe_teaser: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ dependencies:
- core.entity_view_mode.node.teaser
- field.field.node.oe_news.body
- field.field.node.oe_news.oe_author
- field.field.node.oe_news.oe_departments
- field.field.node.oe_news.oe_news_contacts
- field.field.node.oe_news.oe_news_featured_media
- field.field.node.oe_news.oe_news_last_updated
- field.field.node.oe_news.oe_news_location
- field.field.node.oe_news.oe_news_sources
- field.field.node.oe_news.oe_news_types
- field.field.node.oe_news.oe_publication_date
- field.field.node.oe_news.oe_reference_code
- field.field.node.oe_news.oe_related_links
- field.field.node.oe_news.oe_subject
- field.field.node.oe_news.oe_summary
Expand Down Expand Up @@ -65,14 +70,20 @@ content:
third_party_settings: { }
hidden:
body: true
extra_field_oe_theme_content_news_date: true
langcode: true
links: true
oe_author: true
oe_content_content_owner: true
oe_content_legacy_link: true
oe_content_navigation_title: true
oe_content_short_title: true
oe_departments: true
oe_news_contacts: true
oe_news_last_updated: true
oe_news_location: true
oe_news_sources: true
oe_reference_code: true
oe_related_links: true
oe_subject: true
oe_summary: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.full
- field.field.node.oe_news.body
- field.field.node.oe_news.oe_author
- field.field.node.oe_news.oe_departments
- field.field.node.oe_news.oe_news_contacts
- field.field.node.oe_news.oe_news_featured_media
- field.field.node.oe_news.oe_news_last_updated
- field.field.node.oe_news.oe_news_location
- field.field.node.oe_news.oe_news_sources
- field.field.node.oe_news.oe_news_types
- field.field.node.oe_news.oe_publication_date
- field.field.node.oe_news.oe_reference_code
- field.field.node.oe_news.oe_related_links
- field.field.node.oe_news.oe_subject
- field.field.node.oe_news.oe_summary
- field.field.node.oe_news.oe_teaser
- node.type.oe_news
module:
- entity_reference_revisions
- field_group
- link
- rdf_skos
- text
- user
third_party_settings:
field_group:
group_details:
children:
- oe_reference_code
- extra_field_oe_theme_content_news_date
- oe_author
- oe_departments
- oe_news_location
parent_name: ''
weight: 3
format_type: oe_theme_helper_field_list_pattern
region: content
format_settings:
variant: horizontal
label: Details
id: node.oe_news.full
targetEntityType: node
bundle: oe_news
mode: full
content:
body:
label: hidden
type: text_default
weight: 0
settings: { }
third_party_settings: { }
region: content
extra_field_oe_theme_content_news_date:
weight: 13
region: content
settings: { }
third_party_settings: { }
oe_author:
type: skos_concept_entity_reference_label
weight: 14
region: content
label: above
settings:
link: false
third_party_settings: { }
oe_departments:
type: skos_concept_entity_reference_label
weight: 15
region: content
label: above
settings:
link: false
third_party_settings: { }
oe_news_contacts:
type: entity_reference_revisions_entity_view
weight: 4
region: content
label: above
settings:
view_mode: full
link: ''
third_party_settings: { }
oe_news_location:
type: skos_concept_entity_reference_label
weight: 16
region: content
label: above
settings:
link: false
third_party_settings: { }
oe_news_sources:
type: link
weight: 1
region: content
label: hidden
settings:
trim_length: null
url_only: false
url_plain: false
rel: '0'
target: '0'
third_party_settings: { }
oe_reference_code:
type: string
weight: 12
region: content
label: above
settings:
link_to_entity: false
third_party_settings: { }
oe_related_links:
type: link
weight: 5
region: content
label: hidden
settings:
trim_length: null
url_only: false
url_plain: false
rel: '0'
target: '0'
third_party_settings: { }
hidden:
extra_field_oe_theme_helper_short_title_with_fallback: true
langcode: true
links: true
oe_content_content_owner: true
oe_content_legacy_link: true
oe_content_navigation_title: true
oe_content_short_title: true
oe_news_featured_media: true
oe_news_last_updated: true
oe_news_types: true
oe_publication_date: true
oe_subject: true
oe_summary: true
oe_teaser: true
9 changes: 9 additions & 0 deletions modules/oe_theme_content_news/oe_theme_content_news.module
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,21 @@ function oe_theme_content_news_node_view_alter(array &$build, EntityInterface $e
// Rename field labels based on number of items.
$plural_label_overrides = [
'oe_author' => t('Authors'),
'oe_departments' => t('Departments'),
];

$singular_label_overrides = [
'oe_departments' => t('Department'),
];

foreach ($plural_label_overrides as $name => $label_override) {
if (!$entity->get($name)->isEmpty() && $entity->get($name)->count() > 1 && isset($build[$name]['#title'])) {
$build[$name]['#title'] = $label_override;
}
// Override singular labels if defined.
elseif (!$entity->get($name)->isEmpty() && $entity->get($name)->count() == 1 && isset($build[$name]['#title']) && isset($singular_label_overrides[$name])) {
$build[$name]['#title'] = $singular_label_overrides[$name];
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,23 @@ function oe_theme_content_news_post_update_00008(): void {
$display = $storage->createFromStorageRecord($display_values);
$display->save();
}

/**
* Updates the full view display.
*/
function oe_theme_content_news_post_update_00009(): void {
$storage = new FileStorage(drupal_get_path('module', 'oe_theme_content_news') . '/config/post_updates/00009_update_full_view_display');

$display_values = $storage->read('core.entity_view_display.node.oe_news.full');
$storage = \Drupal::entityTypeManager()->getStorage('entity_view_display');

$view_display = EntityViewDisplay::load($display_values['id']);
if ($view_display) {
$display = $storage->updateFromStorageRecord($view_display, $display_values);
$display->save();
return;
}

$display = $storage->createFromStorageRecord($display_values);
$display->save();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types = 1);

namespace Drupal\oe_theme_content_news\Plugin\ExtraField\Display;

use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\oe_theme_helper\Plugin\ExtraField\Display\PublicationDateExtraFieldBase;

/**
* Displays publication date and last update date fields.
*
* @ExtraFieldDisplay(
* id = "oe_theme_content_news_date",
* label = @Translation("Publication date"),
* bundles = {
* "node.oe_news",
* },
* visible = true
* )
*/
class PublicationDate extends PublicationDateExtraFieldBase {

/**
* {@inheritdoc}
*/
public function viewElements(ContentEntityInterface $entity): array {
return $this->renderPublicationDateExtraField($entity, 'oe_theme_news_date');
}

}
Loading