Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects

OEL-579 - Whitelabel - Medley branch with BCL 0.9.0 upgradel

Merged Francesco SARDARA requested to merge OEL-579-all into 1.x
76 files
+ 15233
247
Compare changes
  • Side-by-side
  • Inline
Files
76
@@ -8,6 +8,7 @@ use Drupal\Core\Block\BlockBase;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
@@ -80,15 +81,37 @@ class CorporateEcLogoBlock extends BlockBase implements ContainerFactoryPluginIn
$logo_path = drupal_get_path('module', 'oe_whitelabel_helper') . '/images/logos/ec';
$title = $this->configFactory->get('system.site')->get('name');
$build = [
$image = [
'#theme' => 'image',
'#uri' => $logo_path . '/logo-ec--' . $language . '.svg',
'#width' => '240px',
'#height' => '60px',
'#alt' => $title,
'#title' => $title,
];
$mobile_url = file_create_url($logo_path . '/mobile/logo-ec--' . $language . '.svg');
$inline_template = [
'#type' => 'inline_template',
'#template' => '<picture><source media="(max-width: 25em)" srcset="{{ mobile }}">{{ image }}</picture>',
'#context' => [
'image' => $image,
'mobile' => file_url_transform_relative($mobile_url),
],
];
$build = [
'#type' => 'link',
'#url' => Url::fromUri('https://ec.europa.eu/info/index_' . $language, [
'attributes' => [
'class' => [
'navbar-brand',
],
'target' => '_blank',
],
]),
'#title' => $inline_template,
];
$cache->applyTo($build);
return $build;
Loading