-
Notifications
You must be signed in to change notification settings - Fork 68
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 #26 from ho-nl/develop
Release v0.2.2
- Loading branch information
Showing
8 changed files
with
88 additions
and
68 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 |
---|---|---|
@@ -1,39 +1,68 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2016 H&O E-commerce specialisten B.V. (http://www.h-o.nl/) | ||
* Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/) | ||
* See LICENSE.txt for license details. | ||
*/ | ||
|
||
namespace Ho\Templatehints\Helper; | ||
|
||
use Magento\Developer\Helper\Data as DeveloperHelper; | ||
use Magento\Framework\App\Helper\AbstractHelper; | ||
use Magento\Framework\App\Helper\Context; | ||
use Magento\Framework\App\State as AppState; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
|
||
class Config extends AbstractHelper { | ||
|
||
/** | ||
* @var AppState | ||
*/ | ||
class Config extends AbstractHelper | ||
{ | ||
/** @var AppState $appState */ | ||
private $appState; | ||
|
||
/** @var StoreManagerInterface $storeManager */ | ||
private $storeManager; | ||
|
||
public function __construct(Context $context, AppState $appState) | ||
{ | ||
/** @var DeveloperHelper $developerHelper */ | ||
private $developerHelper; | ||
|
||
/** | ||
* @param Context $context | ||
* @param AppState $appState | ||
* @param StoreManagerInterface $storeManager | ||
* @param DeveloperHelper $developerHelper | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
AppState $appState, | ||
StoreManagerInterface $storeManager, | ||
DeveloperHelper $developerHelper | ||
) { | ||
parent::__construct($context); | ||
|
||
$this->appState = $appState; | ||
$this->storeManager = $storeManager; | ||
$this->developerHelper = $developerHelper; | ||
} | ||
|
||
|
||
/** | ||
* Check if the hints can be displayed, depends on the developer mode and if the url parameter is present. | ||
* Check if the hints can be displayed. | ||
* | ||
* It will check if the url parameter is present. | ||
* For production mode it will also check if the IP-address is in Developer Client Restrictions. | ||
* | ||
* @return bool | ||
*/ | ||
public function isHintEnabled() | ||
{ | ||
$isDeveloperMode = $this->appState->getMode() === AppState::MODE_DEVELOPER; | ||
$isParamPresent = $this->_request->getParam('ath', false) === '1'; | ||
return $isDeveloperMode && $isParamPresent; | ||
|
||
if ($isParamPresent) { | ||
$applicationMode = $this->appState->getMode(); | ||
$storeId = $this->storeManager->getStore()->getId(); | ||
|
||
if ($applicationMode === AppState::MODE_DEVELOPER || $this->developerHelper->isDevAllowed($storeId)) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
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 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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright (c) 2016 H&O E-commerce specialisten B.V. (http://www.h-o.nl/) | ||
* See LICENSE.txt for license details. | ||
*/ | ||
--> | ||
~ Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/) | ||
~ See LICENSE.txt for license details. | ||
--> | ||
|
||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Ho_Templatehints" setup_version="0.2.1" /> | ||
<module name="Ho_Templatehints" setup_version="0.2.2"/> | ||
</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