Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frontend template hints status command #26451

Merged
merged 17 commits into from
Feb 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Developer\Console\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Magento\Framework\App\Config\ConfigResource\ConfigInterface;

class TemplateHintsShowCommand extends Command
{

/**
* command name
*/
const COMMAND_NAME = 'dev:template-hints:show';
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved

/**
* Success message
*/
const SUCCESS_MESSAGE = "Template hints are ";
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved

/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
*/
protected $scopeConfig;

/**
* Initialize dependencies.
*
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
)
{
parent::__construct();
$this->scopeConfig = $scopeConfig;
}

/**
* {@inheritdoc}
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
*/
protected function configure()
{
$this->setName(self::COMMAND_NAME)
->setDescription('Show frontend template hints status.');

parent::configure();
}

/**
* {@inheritdoc}
* @throws \InvalidArgumentException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$templateHintsStatus = ($this->scopeConfig->getValue('dev/debug/template_hints_storefront', 'default')) ? 'enabled' : 'disabled';
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
$templateHintsMessage = self::SUCCESS_MESSAGE . $templateHintsStatus;
$output->writeln("<info>". $templateHintsMessage . "</info>");
}
}
1 change: 1 addition & 0 deletions app/code/Magento/Developer/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
<item name="dev_query_log_disable" xsi:type="object">Magento\Developer\Console\Command\QueryLogDisableCommand</item>
<item name="dev_template_hints_disable" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsDisableCommand</item>
<item name="dev_template_hints_enable" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsEnableCommand</item>
<item name="dev_template_hints_show" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsShowCommand</item>
<item name="dev_profiler_disable" xsi:type="object">Magento\Developer\Console\Command\ProfilerDisableCommand</item>
<item name="dev_profiler_enable" xsi:type="object">Magento\Developer\Console\Command\ProfilerEnableCommand</item>
<item name="dev_generate_patch" xsi:type="object">Magento\Developer\Console\Command\GeneratePatchCommand</item>
Expand Down