-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EWPP-3866: Update available flag options for paragraphs.
- Loading branch information
1 parent
4fbef7c
commit 2407d2b
Showing
3 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
modules/oe_theme_helper/src/EventSubscriber/FlagOptionsEventSubscriber.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Drupal\oe_theme_helper\EventSubscriber; | ||
|
||
use Drupal\Core\StringTranslation\StringTranslationTrait; | ||
use Drupal\oe_paragraphs\Event\FlagOptionsEvent; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
/** | ||
* Event subscriber to alter the list of allowed flag icons. | ||
*/ | ||
class FlagOptionsEventSubscriber implements EventSubscriberInterface { | ||
|
||
use StringTranslationTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function getSubscribedEvents() { | ||
return [ | ||
FlagOptionsEvent::class => 'alterFlagOptions', | ||
]; | ||
} | ||
|
||
/** | ||
* Alter the list of allowed flag icons. | ||
* | ||
* @param \Drupal\oe_paragraphs\Event\FlagOptionsEvent $event | ||
* The event. | ||
*/ | ||
public function alterFlagOptions(FlagOptionsEvent $event): void { | ||
$options = $event->getFlagOptions(); | ||
$options['albania'] = $this->t('Albania'); | ||
$options['bosnia-and-herzegovina'] = $this->t('Bosnia and Herzegovina'); | ||
$options['georgia'] = $this->t('Georgia'); | ||
$options['iceland'] = $this->t('Iceland'); | ||
$options['moldova'] = $this->t('Moldova'); | ||
$options['montenegro'] = $this->t('Montenegro'); | ||
$options['north-macedonia'] = $this->t('North Macedonia'); | ||
$options['norway'] = $this->t('Norway'); | ||
$options['serbia'] = $this->t('Serbia'); | ||
$options['switzerland'] = $this->t('Switzerland'); | ||
$options['turkey'] = $this->t('Turkey'); | ||
$options['ukraine'] = $this->t('Ukraine'); | ||
ksort($options); | ||
$event->setFlagOptions($options); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters