-
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-3102: Allow 2 new icons to be used in field_oe_icon of paragraphs.
- Loading branch information
1 parent
5729b07
commit 0a7bb54
Showing
3 changed files
with
58 additions
and
2 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
40 changes: 40 additions & 0 deletions
40
modules/oe_theme_helper/src/EventSubscriber/IconOptionsEventSubscriber.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,40 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Drupal\oe_theme_helper\EventSubscriber; | ||
|
||
use Drupal\Core\StringTranslation\StringTranslationTrait; | ||
use Drupal\oe_paragraphs\Event\IconOptionsEvent; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
/** | ||
* Event subscriber to alter the list of allowed paragraph icons. | ||
*/ | ||
class IconOptionsEventSubscriber implements EventSubscriberInterface { | ||
|
||
use StringTranslationTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function getSubscribedEvents() { | ||
return [ | ||
IconOptionsEvent::class => 'getIconOptions', | ||
]; | ||
} | ||
|
||
/** | ||
* Alter the list of allowed paragraph icons. | ||
* | ||
* @param \Drupal\oe_paragraphs\Event\IconOptionsEvent $event | ||
* The event. | ||
*/ | ||
public function alterIconOptions(IconOptionsEvent $event): void { | ||
$options = $event->getIconOptions(); | ||
$options['log-in'] = $this->t('Log in'); | ||
$options['logged-in'] = $this->t('Logged in'); | ||
$event->setIconOptions($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