-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-426: Created additional UDW config for adding Location to Content (…
…#1772) * IBX-426: Created additional UDW config for adding Location to Content * IBX-426: CS * IBX-426: Applied review remark
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,3 +72,5 @@ system: | |
multiple_user_group: | ||
multiple: true | ||
allowed_content_types: ['user_group'] | ||
add_location: | ||
multiple: false |
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
34 changes: 34 additions & 0 deletions
34
src/lib/UniversalDiscovery/Event/Subscriber/AddLocation.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,34 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformAdminUi\UniversalDiscovery\Event\Subscriber; | ||
|
||
use EzSystems\EzPlatformAdminUi\UniversalDiscovery\Event\ConfigResolveEvent; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
final class AddLocation implements EventSubscriberInterface | ||
{ | ||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
ConfigResolveEvent::NAME => ['onUdwConfigResolve', -10], | ||
]; | ||
} | ||
|
||
public function onUdwConfigResolve(ConfigResolveEvent $event): void | ||
{ | ||
if ($event->getConfigName() !== 'add_location') { | ||
return; | ||
} | ||
|
||
$config = $event->getConfig(); | ||
$config['allowed_content_types'] = null; | ||
|
||
$event->setConfig($config); | ||
} | ||
} |