Skip to content
Permalink
Browse files

MAGETWO-86349: #12446: Add GetUtilityPageIdentifiers for Manage Custo…

…m Pages to be excluded … #12649
  • Loading branch information...
okorshenko committed Jan 8, 2018
2 parents 8770634 + e6a48fe commit 7e43513c7af1b7dee314037a9d46db67be0fd38a
@@ -0,0 +1,20 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Cms\Api;
/**
* Utility Cms Pages
*
* @api
*/
interface GetUtilityPageIdentifiersInterface
{
/**
* Get List Page Identifiers
* @return array
*/
public function execute();
}
@@ -0,0 +1,54 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Cms\Model;
use Magento\Cms\Api\GetUtilityPageIdentifiersInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
/**
* Utility Cms Pages
*/
class GetUtilityPageIdentifiers implements GetUtilityPageIdentifiersInterface
{
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* UtilityCmsPage constructor.
* @param ScopeConfigInterface $scopeConfig
*/
public function __construct(
ScopeConfigInterface $scopeConfig
) {
$this->scopeConfig = $scopeConfig;
}
/**
* Get List Page Identifiers
* @return array
*/
public function execute()
{
$homePageIdentifier = $this->scopeConfig->getValue(
'web/default/cms_home_page',
ScopeInterface::SCOPE_STORE
);
$noRouteIdentifier = $this->scopeConfig->getValue(
'web/default/cms_no_route',
ScopeInterface::SCOPE_STORE
);
$noCookieIdentifier = $this->scopeConfig->getValue(
'web/default/cms_no_cookies',
ScopeInterface::SCOPE_STORE
);
return [$homePageIdentifier, $noRouteIdentifier, $noCookieIdentifier];
}
}
@@ -14,6 +14,7 @@
<preference for="Magento\Cms\Api\Data\BlockInterface" type="Magento\Cms\Model\Block" />
<preference for="Magento\Cms\Api\BlockRepositoryInterface" type="Magento\Cms\Model\BlockRepository" />
<preference for="Magento\Cms\Api\PageRepositoryInterface" type="Magento\Cms\Model\PageRepository" />
<preference for="Magento\Cms\Api\GetUtilityPageIdentifiersInterface" type="Magento\Cms\Model\GetUtilityPageIdentifiers" />
<type name="Magento\Cms\Model\Wysiwyg\Config">
<arguments>
<argument name="windowSize" xsi:type="array">
@@ -6,20 +6,23 @@
namespace Magento\Sitemap\Model\ResourceModel\Cms;
use Magento\Cms\Api\Data\PageInterface;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Model\ResourceModel\Db\Context;
use Magento\Framework\Model\AbstractModel;
use Magento\Cms\Api\GetUtilityPageIdentifiersInterface;
use Magento\Cms\Model\Page as CmsPage;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DB\Select;
use Magento\Framework\EntityManager\EntityManager;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Model\AbstractModel;
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
use Magento\Framework\Model\ResourceModel\Db\Context;
/**
* Sitemap cms page collection model
*
* @api
* @since 100.0.2
*/
class Page extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
class Page extends AbstractDb
{
/**
* @var MetadataPool
@@ -34,19 +37,29 @@ class Page extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
protected $entityManager;
/**
* @param Context $context
* @param MetadataPool $metadataPool
* @param EntityManager $entityManager
* @param string $connectionName
* @var GetUtilityPageIdentifiersInterface
* @since 100.2.0
*/
private $getUtilityPageIdentifiers;
/**
* @param Context $context
* @param MetadataPool $metadataPool
* @param EntityManager $entityManager
* @param string $connectionName
* @param GetUtilityPageIdentifiersInterface $getUtilityPageIdentifiers
*/
public function __construct(
Context $context,
MetadataPool $metadataPool,
EntityManager $entityManager,
$connectionName = null
$connectionName = null,
GetUtilityPageIdentifiersInterface $getUtilityPageIdentifiers = null
) {
$this->metadataPool = $metadataPool;
$this->entityManager = $entityManager;
$this->metadataPool = $metadataPool;
$this->entityManager = $entityManager;
$this->getUtilityPageIdentifiers = $getUtilityPageIdentifiers ?:
ObjectManager::getInstance()->get(GetUtilityPageIdentifiersInterface::class);
parent::__construct($context, $connectionName);
}
@@ -90,8 +103,8 @@ public function getCollection($storeId)
)->where(
'main_table.is_active = 1'
)->where(
'main_table.identifier != ?',
\Magento\Cms\Model\Page::NOROUTE_PAGE_ID
'main_table.identifier NOT IN (?)',
$this->getUtilityPageIdentifiers->execute()
)->where(
'store_table.store_id IN(?)',
[0, $storeId]
@@ -9,6 +9,7 @@
<module name="Magento_Sitemap" setup_version="2.0.0">
<sequence>
<module name="Magento_Robots"/>
<module name="Magento_Cms"/>
<module name="Magento_Catalog"/>
</sequence>
</module>

0 comments on commit 7e43513

Please sign in to comment.
You can’t perform that action at this time.