Skip to content

Commit

Permalink
#6 Only show info if module is enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
drew7721 committed Oct 11, 2019
1 parent 92e5a6f commit 7024ff5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
27 changes: 27 additions & 0 deletions Block/Info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace JustinKase\LayoutHints\Block;

use JustinKase\LayoutHints\Api\WrapperInterface;
use Magento\Framework\View\Element\Template;

/**
* Class Info
*
* @author Alex Ghiban <drew7721@gmail.com>
*/
class Info extends Template
{
/**
* Should the jk-hints info show?
*
* Checks the app state and the status of the module.
*
* @return bool
*/
public function isJustinKaseHintsEnabled()
{
return ($this->_appState->getMode() === $this->_appState::MODE_DEVELOPER)
&& $this->_scopeConfig->getValue(WrapperInterface::JK_CONFIG_BLOCK_HINTS_STATUS);
}
}
2 changes: 1 addition & 1 deletion view/frontend/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>
<referenceContainer name="root">
<block name="justinkase_layout_info" class="Magento\Framework\View\Element\Template" as="jkase_info" template="JustinKase_LayoutHints::info.phtml"/>
<block name="justinkase_layout_info" as="jkase_info" class="JustinKase\LayoutHints\Block\Info" template="JustinKase_LayoutHints::info.phtml" after="-"/>
</referenceContainer>
</body>
</page>
16 changes: 9 additions & 7 deletions view/frontend/templates/info.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
*
* @author Alex Ghiban <drew7721@gmail.com>
*
* @var \Magento\Framework\View\Element\Template $block
* @var \JustinKase\LayoutHints\Block\Info $block
*/
?>
<div class="justinkase-hint-footer">
<h4>Used Layout Update Handles</h4>
<?php var_dump($block->getLayout()->getUpdate()->getHandles());?>
<h4>Suggested Available Containers</h4>
<?php var_dump($block->getLayout()->getUpdate()->getContainers());?>
</div>
<?php if($block->isJustinKaseHintsEnabled()): ?>
<div class="justinkase-hint-footer">
<h4>Used Layout Update Handles</h4>
<?php var_dump($block->getLayout()->getUpdate()->getHandles());?>
<h4>Suggested Available Containers</h4>
<?php var_dump($block->getLayout()->getUpdate()->getContainers());?>
</div>
<?php endif; ?>

0 comments on commit 7024ff5

Please sign in to comment.