From 0866771b45f208c3d32411795c36bee4a82c6ecf Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Fri, 11 Feb 2022 13:35:03 +0100 Subject: [PATCH] OEL-1147: Add NeutralFooterBlock extending from FooterBlockBase. --- .../src/Plugin/Block/NeutralFooterBlock.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php diff --git a/modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php b/modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php new file mode 100644 index 00000000..f1a7c1a6 --- /dev/null +++ b/modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php @@ -0,0 +1,44 @@ +<?php + +declare(strict_types = 1); + +namespace Drupal\oe_whitelabel_helper\Plugin\Block; + +use Drupal\Component\Utility\NestedArray; +use Drupal\Core\Cache\CacheableMetadata; +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\oe_corporate_blocks\Plugin\Block\FooterBlockBase; + +/** + * Provides the corporate EU footer block. + * + * @Block( + * id = "oe_corporate_blocks_neutral_footer", + * admin_label = @Translation("Neutral Footer block"), + * category = @Translation("Corporate blocks"), + * ) + */ +class NeutralFooterBlock extends FooterBlockBase implements ContainerFactoryPluginInterface { + + /** + * {@inheritdoc} + */ + public function build() { + $cache = new CacheableMetadata(); + $cache->addCacheContexts(['languages:language_interface']); + + $config = $this->configFactory->get('oe_corporate_blocks.ec_data.footer'); + $cache->addCacheableDependency($config); + + $build['#theme'] = 'oe_corporate_blocks_neutral_footer'; + + NestedArray::setValue($build, ['#corporate_footer', 'content_owner_details'], $config->get('content_owner_details')); + + $this->setSiteSpecificFooter($build, $cache); + + $cache->applyTo($build); + + return $build; + } + +} -- GitLab