protected function execute(InputInterface $input, OutputInterface $output)
{
$this->detectMagento($output, true);
if (!$this->initMagento()) {
return;
}
$blockId = $input->getArgument('block_id');
if (is_numeric($blockId)) {
$block = $this->_getBlockModel()->load($blockId);
} else {
$block = $this->_getBlockModel()->load($blockId, 'identifier');
}
if (!$block->getId()) {
return $output->writeln('<error>Block was not found</error>');
}
$newStatus = !$block->getIsActive();
$block->setIsActive($newStatus)->save();
$output->writeln(sprintf('<comment>Block</comment> <info>%s</info>', $newStatus ? 'enabled' : 'disabled'));
}