TemplateHintsDisableCommand.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Developer\Console\Command;
  7. use Symfony\Component\Console\Command\Command;
  8. use Symfony\Component\Console\Input\InputInterface;
  9. use Symfony\Component\Console\Output\OutputInterface;
  10. use Magento\Framework\App\Config\ConfigResource\ConfigInterface;
  11. class TemplateHintsDisableCommand extends Command
  12. {
  13. /**
  14. * command name
  15. */
  16. const COMMAND_NAME = 'dev:template-hints:disable';
  17. /**
  18. * Success message
  19. */
  20. const SUCCESS_MESSAGE = "Template hints disabled. Refresh cache types";
  21. /**
  22. * @var ConfigInterface
  23. */
  24. private $resourceConfig;
  25. /**
  26. * Initialize dependencies.
  27. *
  28. * @param ConfigInterface $resourceConfig
  29. */
  30. public function __construct(ConfigInterface $resourceConfig)
  31. {
  32. parent::__construct();
  33. $this->resourceConfig = $resourceConfig;
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. protected function configure()
  39. {
  40. $this->setName(self::COMMAND_NAME)
  41. ->setDescription('Disable frontend template hints. A cache flush might be required.');
  42. parent::configure();
  43. }
  44. /**
  45. * {@inheritdoc}
  46. * @throws \InvalidArgumentException
  47. */
  48. protected function execute(InputInterface $input, OutputInterface $output)
  49. {
  50. $this->resourceConfig->saveConfig('dev/debug/template_hints_storefront', 0, 'default', 0);
  51. $output->writeln("<info>". self::SUCCESS_MESSAGE . "</info>");
  52. }
  53. }