-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZEE-2533: Error HTTP 400 trying to preview Form during creation
- Loading branch information
1 parent
b0f9146
commit 039b3db
Showing
3 changed files
with
87 additions
and
12 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
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,59 @@ | ||
<?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\Siteaccess; | ||
|
||
use eZ\Publish\Core\MVC\ConfigResolverInterface; | ||
|
||
class RootLocationsProvider | ||
{ | ||
private const ROOT_LOCATIONS_PARAMETER_NAMES = [ | ||
'content.tree_root.location_id', | ||
'location_ids.media', | ||
'form_builder.forms_location_id', | ||
]; | ||
|
||
/** @var ConfigResolverInterface */ | ||
private $configResolver; | ||
|
||
/** | ||
* @param ConfigResolverInterface $configResolver | ||
*/ | ||
public function __construct(ConfigResolverInterface $configResolver) | ||
{ | ||
$this->configResolver = $configResolver; | ||
} | ||
|
||
/** | ||
* Gets all root locations (e.g. root location for Forms and Media) available in given siteaccess. | ||
* | ||
* @param string $siteaccess | ||
* | ||
* @return array | ||
*/ | ||
public function getRootLocations(string $siteaccess): array | ||
{ | ||
$rootLocations = []; | ||
|
||
foreach (self::ROOT_LOCATIONS_PARAMETER_NAMES as $rootLocationParameterName) { | ||
if ($this->configResolver->hasParameter( | ||
$rootLocationParameterName, | ||
null, | ||
$siteaccess | ||
)) { | ||
$rootLocations[] = $this->configResolver->getParameter( | ||
$rootLocationParameterName, | ||
null, | ||
$siteaccess | ||
); | ||
} | ||
} | ||
|
||
return $rootLocations; | ||
} | ||
} |
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