diff --git a/Block/Hints/Init.php b/Block/Hints/Init.php
index f9a9f87..0960196 100644
--- a/Block/Hints/Init.php
+++ b/Block/Hints/Init.php
@@ -1,6 +1,6 @@
isHintEnabled()) {
$this->assetRepository = $context->getAssetRepository();
$this->assetCollection = $assetCollection;
@@ -54,7 +47,6 @@ public function __construct(
return parent::__construct($context, $data);
}
-
/**
* Add assets to the header required for the initialisation of the scripts
*
diff --git a/Helper/Config.php b/Helper/Config.php
index d1621b0..a8ad420 100644
--- a/Helper/Config.php
+++ b/Helper/Config.php
@@ -1,39 +1,68 @@
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;
}
}
diff --git a/Plugin/View/LayoutPlugin.php b/Plugin/View/LayoutPlugin.php
index efe5ced..d098915 100644
--- a/Plugin/View/LayoutPlugin.php
+++ b/Plugin/View/LayoutPlugin.php
@@ -1,8 +1,9 @@
hintConfig = $hintConfig;
$this->directoryList = $directoryList;
+ $this->hintConfig = $hintConfig;
$this->layout = $layout;
$layoutReflection = new \ReflectionClass($this->layout);
@@ -76,6 +71,7 @@ public function aroundRenderElement(Layout $layout, Closure $proceed, $name, $us
if ($this->hintConfig->isHintEnabled() === false) {
return $result;
}
+
return $this->_decorateElement($result, $name);
}
@@ -120,8 +116,7 @@ private function _decorateElement($result, $name)
*/
public function decorateOuterElement($html, $attributes)
{
-
- if (!$html) {
+ if (! $html) {
return $html;
}
@@ -137,12 +132,13 @@ public function decorateOuterElement($html, $attributes)
$html,
1
);
+
return $html;
}
/**
* @param string $nameInLayout
- * @param [] $container
+ * @param array $container
*
* @return string
*/
@@ -198,8 +194,10 @@ public static function filterEscapeEncode(array $data)
}
/**
- * Filter and escape the complete array
+ * Filter and escape the complete array.
+ *
* @param $data
+ *
* @return array
*/
private static function filterEscape($data)
@@ -237,6 +235,7 @@ private function getBlockClass(\Magento\Framework\View\Element\AbstractBlock $bl
$reflector = new \ReflectionClass($block); //@codingStandardsIgnoreLine
$className = $reflector->getParentClass()->getName();
}
+
return $className;
}
}
diff --git a/README.md b/README.md
index ab4ac77..457004b 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ php bin/magento setup:upgrade

## Usage
-1. Set your Magento 2 installation to developer mode.
+1. Set your Magento 2 installation to developer mode (when in production mode make sure to add your IP-address in Developer Client Restrictions).
2. Add `?ath=1` to your URL to activate.
3. Open up your console in you Chrome/Firefox/Safari/~IE~ devtools.
4. hold ⇧ (shift)
diff --git a/composer.json b/composer.json
index 97a82dd..e0ea5f4 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,6 @@
"php": "~5.5.0|~5.6.0|~7.0.0"
},
"type": "magento2-module",
- "version": "0.2.1",
"license": "BSD-2-Clause",
"autoload": {
"files": [
@@ -24,5 +23,10 @@
"psr-4": {
"Ho\\Templatehints\\": ""
}
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.2-dev"
+ }
}
}
diff --git a/etc/di.xml b/etc/di.xml
index 7fc7a75..14cfbf0 100644
--- a/etc/di.xml
+++ b/etc/di.xml
@@ -1,12 +1,10 @@
-
+ ~ Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
+ ~ See LICENSE.txt for license details.
+ -->
+
diff --git a/etc/module.xml b/etc/module.xml
index 6b58580..7528d5f 100644
--- a/etc/module.xml
+++ b/etc/module.xml
@@ -1,10 +1,9 @@
+ ~ Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
+ ~ See LICENSE.txt for license details.
+ -->
+
-
+
diff --git a/view/base/layout/default.xml b/view/base/layout/default.xml
index 16c479b..df3c524 100644
--- a/view/base/layout/default.xml
+++ b/view/base/layout/default.xml
@@ -1,10 +1,9 @@
+ ~ Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
+ ~ See LICENSE.txt for license details.
+ -->
+