Skip to content

Commit

Permalink
OEL-494: The union languages helper class is now available in the par…
Browse files Browse the repository at this point in the history
…ent theme.
  • Loading branch information
brummbar committed Apr 6, 2022
1 parent d6aaabe commit bb0bc7a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 141 deletions.
120 changes: 0 additions & 120 deletions modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php

This file was deleted.

19 changes: 0 additions & 19 deletions modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

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;
Expand Down Expand Up @@ -37,7 +36,6 @@ public function __construct(CacheableDependencyInterface $plugin_manager_block)
public function getFilters(): array {
return [
new TwigFilter('bcl_timeago', [$this, 'bclTimeAgo']),
new TwigFilter('to_internal_language_id', [$this, 'toInternalLanguageId']),
];
}

Expand Down Expand Up @@ -184,21 +182,4 @@ public function bclBlock(string $id, array $configuration = []): array {
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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
declare(strict_types = 1);

use Drupal\Component\Utility\Html;
use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages;
use Drupal\oe_bootstrap_theme_helper\EuropeanUnionLanguages;

/**
* Implements hook_preprocess_links().
Expand Down
2 changes: 1 addition & 1 deletion oe_whitelabel.theme
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ declare(strict_types = 1);

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\oe_bootstrap_theme_helper\EuropeanUnionLanguages;
use Drupal\oe_whitelabel\DocumentMediaWrapper;
use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages;

// Include all files from the includes directory.
$includes_path = __DIR__ . '/includes/*.inc';
Expand Down

0 comments on commit bb0bc7a

Please sign in to comment.