-
Notifications
You must be signed in to change notification settings - Fork 7
/
EuFooterBlock.php
49 lines (37 loc) · 1.21 KB
/
EuFooterBlock.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
<?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 EU footer block.
*
* @Block(
* id = "oe_corporate_blocks_eu_footer",
* admin_label = @Translation("EU Footer block"),
* category = @Translation("Corporate blocks"),
* )
*/
class EuFooterBlock extends FooterBlockBase implements ContainerFactoryPluginInterface {
/**
* {@inheritdoc}
*/
public function build() {
$cache = new CacheableMetadata();
$cache->addCacheContexts(['languages:language_interface']);
$config = $this->configFactory->get('oe_corporate_blocks.eu_data.footer');
$cache->addCacheableDependency($config);
$build['#theme'] = 'oe_corporate_blocks_eu_footer';
$data = $config->get();
if (!empty($data['content_owner_details'])) {
$data['content_owner_details'] = [
'#markup' => $data['content_owner_details'],
];
}
NestedArray::setValue($build, ['#corporate_footer'], $data);
$this->setSiteSpecificFooter($build, $cache);
$cache->applyTo($build);
return $build;
}
}