-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1778 from dpfaffenbauer/issues/refactor-theme-con…
…text [ThemeBundle] refactor theme-context to work with area-bricks
- Loading branch information
Showing
8 changed files
with
134 additions
and
16 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
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 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
51 changes: 51 additions & 0 deletions
51
src/CoreShop/Component/Store/Context/RequestBased/PimcoreAreaBrickRenderResolver.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 | ||
/** | ||
* CoreShop. | ||
* | ||
* This source file is subject to the GNU General Public License version 3 (GPLv3) | ||
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt | ||
* files that are distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Component\Store\Context\RequestBased; | ||
|
||
use CoreShop\Component\Store\Context\StoreNotFoundException; | ||
use CoreShop\Component\Store\Model\StoreInterface; | ||
use CoreShop\Component\Store\Repository\StoreRepositoryInterface; | ||
use Pimcore\Model\Document; | ||
use Pimcore\Model\Site; | ||
use Pimcore\Tool\Frontend; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
final class PimcoreAreaBrickRenderResolver implements RequestResolverInterface | ||
{ | ||
public function __construct(private StoreRepositoryInterface $storeRepository) | ||
{ | ||
} | ||
|
||
public function findStore(Request $request): ?StoreInterface | ||
{ | ||
if ($request->attributes->get('_route') === 'pimcore_admin_document_page_areabrick-render-index-editmode') { | ||
$documentId = $request->request->get('documentId'); | ||
|
||
if ($documentId) { | ||
$document = Document::getById((int)$documentId); | ||
|
||
if ($document) { | ||
$site = Frontend::getSiteForDocument($document); | ||
|
||
if ($site instanceof Site) { | ||
return $this->storeRepository->findOneBySite($site->getId()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
throw new StoreNotFoundException(); | ||
} | ||
} |