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 6 commits
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,64 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
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\ScopeConfigInterface;

/**
* Command to show frontend template hints status
*/
class TemplateHintsStatusCommand extends Command
{

const COMMAND_NAME = 'dev:template-hints:status';

/**
* @var ScopeConfigInterface
*/
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
protected $scopeConfig;
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved

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

/**
* @inheritdoc
*/
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->isSetFlag('dev/debug/template_hints_storefront', 'default'))
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
? 'enabled'
: 'disabled';
$templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]);
$output->writeln("<info>" . $templateHintsMessage . "</info>");
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved

return 0;
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
}
WaPoNe marked this conversation as resolved.
Show resolved Hide resolved
}
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_status" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsStatusCommand</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