Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-cms
Controller
Adminhtml
Page
MassDisable.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Cms\Controller\Adminhtml\Page
;
7
8
use
Magento\Framework\App\Action\HttpPostActionInterface
as HttpPostActionInterface;
9
use
Magento\Framework\Controller\ResultFactory
;
10
use
Magento\Backend\App\Action\Context
;
11
use
Magento\Ui\Component\MassAction\Filter
;
12
use Magento\Cms\Model\ResourceModel\Page\CollectionFactory;
13
17
class
MassDisable
extends
\Magento\Backend\App\Action
implements HttpPostActionInterface
18
{
24
const
ADMIN_RESOURCE
=
'Magento_Cms::save'
;
25
29
protected
$filter
;
30
34
protected
$collectionFactory
;
35
41
public
function
__construct
(
Context
$context,
Filter
$filter
, CollectionFactory
$collectionFactory
)
42
{
43
$this->filter =
$filter
;
44
$this->collectionFactory =
$collectionFactory
;
45
parent::__construct($context);
46
}
47
54
public
function
execute
()
55
{
56
$collection
= $this->filter->getCollection($this->collectionFactory->create());
57
58
foreach
(
$collection
as
$item
) {
59
$item
->setIsActive(
false
);
60
$item
->save();
61
}
62
63
$this->messageManager->addSuccessMessage(
64
__
(
'A total of %1 record(s) have been disabled.'
,
$collection
->getSize())
65
);
66
68
$resultRedirect = $this->resultFactory->create(
ResultFactory::TYPE_REDIRECT
);
69
return
$resultRedirect->setPath(
'*/*/'
);
70
}
71
}
Magento\Ui\Component\MassAction\Filter
Definition:
Filter.php:21
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
__
__()
Definition:
__.php:13
$item
$item
Definition:
partial_invoice.php:27
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Backend\App\Action
Definition:
Action.php:17
Magento\Cms\Controller\Adminhtml\Page\MassDisable\ADMIN_RESOURCE
const ADMIN_RESOURCE
Definition:
MassDisable.php:24
Magento\Cms\Controller\Adminhtml\Page\MassDisable\$filter
$filter
Definition:
MassDisable.php:29
Magento\Cms\Controller\Adminhtml\Page\MassDisable\__construct
__construct(Context $context, Filter $filter, CollectionFactory $collectionFactory)
Definition:
MassDisable.php:41
Magento\Cms\Controller\Adminhtml\Page\MassDisable
Definition:
MassDisable.php:17
Magento\Framework\Controller\ResultFactory\TYPE_REDIRECT
const TYPE_REDIRECT
Definition:
ResultFactory.php:24
Magento\Backend\App\Action\Context
Definition:
Context.php:25
Magento\Framework\App\Action\HttpPostActionInterface
Definition:
HttpPostActionInterface.php:16
Magento\Cms\Controller\Adminhtml\Page
Definition:
Delete.php:7
Magento\Cms\Controller\Adminhtml\Page\MassDisable\$collectionFactory
$collectionFactory
Definition:
MassDisable.php:34
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17