-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathEcFooterBlock.php
50 lines (35 loc) · 1.53 KB
/
EcFooterBlock.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
declare(strict_types=1);
namespace Drupal\oe_corporate_blocks\Plugin\Block;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
/**
* Provides the corporate footer block.
*
* @Block(
* id = "oe_corporate_blocks_ec_footer",
* admin_label = @Translation("EC Footer block"),
* category = @Translation("Corporate blocks"),
* )
*/
class EcFooterBlock 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_ec_footer';
NestedArray::setValue($build, ['#corporate_footer', 'corporate_site_link'], $config->get('corporate_site_link'));
NestedArray::setValue($build, ['#corporate_footer', 'content_owner_details'], $config->get('content_owner_details'));
NestedArray::setValue($build, ['#corporate_footer', 'class_navigation'], $config->get('class_navigation'));
NestedArray::setValue($build, ['#corporate_footer', 'service_navigation'], $config->get('service_navigation'));
NestedArray::setValue($build, ['#corporate_footer', 'legal_navigation'], $config->get('legal_navigation'));
$this->setSiteSpecificFooter($build, $cache);
$cache->applyTo($build);
return $build;
}
}