Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects

OEL-494: Style document paragraph.

Merged Francesco SARDARA requested to merge OEL-494 into 1.x
9 files
+ 402
144
Compare changes
  • Side-by-side
  • Inline
Files
9
@@ -6,7 +6,6 @@ namespace Drupal\oe_whitelabel_helper\TwigExtension;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages;
use Drupal\Core\Url;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
@@ -37,7 +36,6 @@ class TwigExtension extends AbstractExtension {
public function getFilters(): array {
return [
new TwigFilter('bcl_timeago', [$this, 'bclTimeAgo']),
new TwigFilter('to_internal_language_id', [$this, 'toInternalLanguageId']),
];
}
@@ -184,21 +182,4 @@ class TwigExtension extends AbstractExtension {
return $block_plugin->build();
}
/**
* Get an internal language ID given its code.
*
* @param string $language_code
* The language code as defined by the W3C language tags document.
*
* @return string
* The internal language ID, or the given language code if none found.
*/
public function toInternalLanguageId(string $language_code): string {
if (EuropeanUnionLanguages::hasLanguage($language_code)) {
return EuropeanUnionLanguages::getInternalLanguageCode($language_code);
}
return $language_code;
}
}
Loading