-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-28636: Universal Discovery Widget should have configurable root l…
…ocation ID
- Loading branch information
Showing
22 changed files
with
167 additions
and
30 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
57 changes: 57 additions & 0 deletions
57
src/bundle/DependencyInjection/Configuration/Parser/Module/UniversalDiscoveryWidget.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,57 @@ | ||
<?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\EzPlatformAdminUiBundle\DependencyInjection\Configuration\Parser\Module; | ||
|
||
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser; | ||
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; | ||
use Symfony\Component\Config\Definition\Builder\NodeBuilder; | ||
|
||
/** | ||
* Configuration parser for UDW module. | ||
*/ | ||
class UniversalDiscoveryWidget extends AbstractParser | ||
{ | ||
/** | ||
* Adds semantic configuration definition. | ||
* | ||
* @param NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess> | ||
*/ | ||
public function addSemanticConfig(NodeBuilder $nodeBuilder) | ||
{ | ||
$nodeBuilder | ||
->arrayNode('universal_discovery_widget_module') | ||
->info('UDW module configuration') | ||
->children() | ||
->scalarNode('default_location_id')->isRequired()->end() | ||
->end() | ||
->end(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void | ||
{ | ||
if (empty($scopeSettings['universal_discovery_widget_module'])) { | ||
return; | ||
} | ||
|
||
$settings = $scopeSettings['universal_discovery_widget_module']; | ||
|
||
if (!isset($settings['default_location_id']) || empty($settings['default_location_id'])) { | ||
return; | ||
} | ||
|
||
$contextualizer->setContextualParameter( | ||
'universal_discovery_widget_module.default_location_id', | ||
$currentScope, | ||
$settings['default_location_id'] | ||
); | ||
} | ||
} |
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
src/lib/UI/Config/Provider/Module/UniversalDiscoveryWidget.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,41 @@ | ||
<?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. | ||
*/ | ||
namespace EzSystems\EzPlatformAdminUi\UI\Config\Provider\Module; | ||
|
||
use eZ\Publish\Core\MVC\ConfigResolverInterface; | ||
use EzSystems\EzPlatformAdminUi\UI\Config\ProviderInterface; | ||
|
||
/** | ||
* Provides information about current user with resolved profile picture. | ||
*/ | ||
class UniversalDiscoveryWidget implements ProviderInterface | ||
{ | ||
/** @var ConfigResolverInterface */ | ||
private $configResolver; | ||
|
||
/** | ||
* @param ConfigResolverInterface $configResolver | ||
*/ | ||
public function __construct( | ||
ConfigResolverInterface $configResolver | ||
) { | ||
$this->configResolver = $configResolver; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getConfig(): array | ||
{ | ||
/* config structure has to reflect UDW module's config structure */ | ||
return [ | ||
'startingLocationId' => $this->configResolver->getParameter( | ||
'universal_discovery_widget_module.default_location_id' | ||
), | ||
]; | ||
} | ||
} |