From ebcda85a802644f1cdb7f3c3e21659221f2395a5 Mon Sep 17 00:00:00 2001 From: Sergii Pavlenko Date: Thu, 20 Jan 2022 18:38:48 +0200 Subject: [PATCH] EWPP-1822: Remove usage of custom css class and apply some code improvements. --- .../oe_theme_content_event/js/event_livestream.js | 3 +-- .../Display/InfoDisclosureExtraFieldBase.php | 12 ++++++------ .../oe-theme-content-event-livestream.html.twig | 7 +------ ...-theme-content-event-online-description.html.twig | 2 +- sass/components/_global.scss | 4 ---- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/modules/oe_theme_content_event/js/event_livestream.js b/modules/oe_theme_content_event/js/event_livestream.js index 999a1799c..f636d6ee8 100644 --- a/modules/oe_theme_content_event/js/event_livestream.js +++ b/modules/oe_theme_content_event/js/event_livestream.js @@ -15,8 +15,7 @@ attach: function attach(context) { setTimeout(function () { Array.prototype.forEach.call(document.querySelectorAll('[data-livestream-element]'), function (element) { - element.classList.remove('hidden'); - element.classList.remove('ecl-link--hidden'); + element.classList.remove('ecl-u-d-none'); }); }, drupalSettings.oe_theme_content_event.livestream_starttime_timestamp - Date.now()) }, diff --git a/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/InfoDisclosureExtraFieldBase.php b/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/InfoDisclosureExtraFieldBase.php index 722f45d5c..9925e8b41 100644 --- a/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/InfoDisclosureExtraFieldBase.php +++ b/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/InfoDisclosureExtraFieldBase.php @@ -63,15 +63,15 @@ public static function create(ContainerInterface $container, array $configuratio /** * Is current day. * - * @param int $start_timestamp + * @param int $timestamp * The timestamp of start date. * * @return bool * True if timestamp is within current day. */ - protected function isCurrentDay(int $start_timestamp): bool { + protected function isCurrentDay(int $timestamp): bool { $current_date = $this->dateFormatter->format($this->requestDateTime->getTimestamp(), 'custom', 'Ymd'); - $start_day = $this->dateFormatter->format($start_timestamp, 'custom', 'Ymd'); + $start_day = $this->dateFormatter->format($timestamp, 'custom', 'Ymd'); return $current_date === $start_day; } @@ -80,15 +80,15 @@ protected function isCurrentDay(int $start_timestamp): bool { * * @param array $build * The render array. - * @param int $start_timestamp + * @param int $timestamp * The timestamp of start date. */ - protected function addLivestreamDisclosure(array &$build, int $start_timestamp): void { + protected function addLivestreamDisclosure(array &$build, int $timestamp): void { $build['#attached'] = [ 'library' => 'oe_theme_content_event/livestream_link_disclosure', 'drupalSettings' => [ 'oe_theme_content_event' => [ - 'livestream_starttime_timestamp' => $start_timestamp * 1000, + 'livestream_starttime_timestamp' => $timestamp * 1000, ], ], ]; diff --git a/modules/oe_theme_content_event/templates/oe-theme-content-event-livestream.html.twig b/modules/oe_theme_content_event/templates/oe-theme-content-event-livestream.html.twig index 270f15a81..4aa0a182f 100644 --- a/modules/oe_theme_content_event/templates/oe-theme-content-event-livestream.html.twig +++ b/modules/oe_theme_content_event/templates/oe-theme-content-event-livestream.html.twig @@ -8,11 +8,6 @@
{{ date }}
{% endif %} {% if label is not empty %} - {# - Use custom 'ecl-link--hidden' class in case we need to hide the link. - Usage of 'hidden' attribute is restricted by priorities of CSS rule. - Built-in classes of 'link' component have higher priority and override display rules. - #} {% include '@ecl-twig/link' with { link: { type: 'standalone', @@ -30,6 +25,6 @@ name: 'data-livestream-element' }, ], - extra_classes: hide_link ? 'ecl-link--hidden', + extra_classes: hide_link ? 'ecl-u-d-none', } %} {% endif %} diff --git a/modules/oe_theme_content_event/templates/oe-theme-content-event-online-description.html.twig b/modules/oe_theme_content_event/templates/oe-theme-content-event-online-description.html.twig index 1d8c9fd08..7376f7938 100644 --- a/modules/oe_theme_content_event/templates/oe-theme-content-event-online-description.html.twig +++ b/modules/oe_theme_content_event/templates/oe-theme-content-event-online-description.html.twig @@ -5,7 +5,7 @@ */ #} {% if description is not empty %} -