forked from abelbm/magento2-disable-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7c407a7
Showing
7 changed files
with
804 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
namespace Abelbm\DisableFrontend\Observer; | ||
use Magento\Framework\Event\ObserverInterface; | ||
|
||
class DisableFrontend implements ObserverInterface{ | ||
|
||
protected $_actionFlag; | ||
protected $redirect; | ||
private $HelperBackend; | ||
private $logger; | ||
|
||
/** | ||
* | ||
* @author Abel Bolanos Martinez <[email protected]> | ||
* @param \Magento\Framework\App\ActionFlag $actionFlag | ||
* @param \Magento\Framework\Message\ManagerInterface $messageManager | ||
* @param \Magento\Framework\App\Response\RedirectInterface $redirect | ||
* @param \Magento\Backend\Helper\Data $HelperBackend | ||
* @param \Psr\Log\LoggerInterface $logger | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\App\ActionFlag $actionFlag, | ||
\Magento\Framework\App\Response\RedirectInterface $redirect, | ||
\Magento\Backend\Helper\Data $HelperBackend, | ||
\Psr\Log\LoggerInterface $logger | ||
) { | ||
$this->_actionFlag = $actionFlag; | ||
$this->redirect = $redirect; | ||
$this->HelperBackend = $HelperBackend; | ||
$this->logger = $logger; | ||
} | ||
|
||
/** | ||
* | ||
* @author Abel Bolanos Martinez <[email protected]> | ||
* @param \Magento\Framework\Event\Observer $observer | ||
* @return void | ||
*/ | ||
public function execute(\Magento\Framework\Event\Observer $observer){ | ||
|
||
//$this->logger->info('TEST LOGGER'); | ||
|
||
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true); | ||
|
||
//custom redirect | ||
//$controller = $observer->getControllerAction(); | ||
//$this->redirect->redirect($controller->getResponse(),$this->HelperBackend->getHomePageUrl()); | ||
} | ||
} |
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,26 @@ | ||
## Disable Frontend | ||
Magento 2 | ||
|
||
#### 1 - Installation Disable Frontend | ||
|
||
##### Manual Installation | ||
|
||
Install Disable Frontend for Magento2 | ||
* Download the extension | ||
* Unzip the file | ||
* Create a folder {Magento root}/app/code/Abelbm/DisableFrontend | ||
* Copy the content from the unzip folder | ||
|
||
|
||
##### Using Composer | ||
|
||
``` | ||
composer require abelbm/disablefrontend:dev-master | ||
``` | ||
|
||
#### 2 - Enable Disable Frontend | ||
|
||
* php bin/magento module:enable Abelbm_DisableFrontend | ||
* php bin/magento setup:upgrade | ||
* php bin/magento cache:flush | ||
* php bin/magento setup:di:compile |
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,34 @@ | ||
{ | ||
"name": "abelbm/disablefrontend", | ||
"description": "Disable Frontend", | ||
"keywords": [ | ||
"magento 2", | ||
"Disable", | ||
"Frontend", | ||
"Disable Frontend Magento 2" | ||
], | ||
"require": { | ||
"php": "~5.5.0|~5.6.0|~7.0.0" | ||
}, | ||
"type": "magento2-module", | ||
"version": "1.0.0", | ||
"license": [ | ||
"AGPL-3.0" | ||
], | ||
"author": [ | ||
{ | ||
"name": "Abel Bolanos Martinez", | ||
"email": "[email protected]", | ||
"homepage": "http://abelbolanos.blogspot.com/", | ||
"role": "Developer" | ||
} | ||
], | ||
"autoload": { | ||
"files": [ | ||
"registration.php" | ||
], | ||
"psr-4": { | ||
"Abelbm\\DisableFrontend\\": "" | ||
} | ||
} | ||
} |
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,6 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> | ||
<event name="controller_action_predispatch"> | ||
<observer name="disable_frontend_observer" instance="Abelbm\DisableFrontend\Observer\DisableFrontend"/> | ||
</event> | ||
</config> |
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,8 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Abelbm_DisableFrontend" setup_version="1.0.0"> | ||
<sequence> | ||
<module name="Magento_Store"/> | ||
</sequence> | ||
</module> | ||
</config> |
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,7 @@ | ||
<?php | ||
|
||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'Abelbm_DisableFrontend', | ||
__DIR__ | ||
); |