Skip to content

Commit

Permalink
Order use statements alphabetically. Remove unused variables for drup…
Browse files Browse the repository at this point in the history
…al root. Add comment for the class. Rename base_theme to theme to be consistent with the option name. Fix coding issues (#3665)
  • Loading branch information
LOBsTerr authored and jmolivas committed Jan 10, 2018
1 parent 77f518f commit 78b6fd8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
43 changes: 21 additions & 22 deletions src/Command/Generate/BreakPointCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@

namespace Drupal\Console\Command\Generate;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Core\Command\Command;
use Drupal\Core\Extension\ThemeHandler;
use Drupal\Console\Command\Shared\ThemeRegionTrait;
use Drupal\Console\Command\Shared\ThemeBreakpointTrait;
use Drupal\Console\Command\Shared\ConfirmationTrait;
use Drupal\Console\Command\Shared\ThemeBreakpointTrait;
use Drupal\Console\Command\Shared\ThemeRegionTrait;
use Drupal\Console\Core\Command\Command;
use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\Console\Utils\Validator;
use Drupal\Console\Core\Utils\StringConverter;
use Drupal\Console\Generator\BreakPointGenerator;
use Drupal\Console\Utils\Validator;
use Drupal\Core\Extension\ThemeHandler;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Class BreakPointCommand
*
* @package Drupal\Console\Command\Generate
*/
class BreakPointCommand extends Command
{
Expand Down Expand Up @@ -49,10 +51,9 @@ class BreakPointCommand extends Command
*/
protected $themeHandler;


/**
* @var Validator
*/
* @var Validator
*/
protected $validator;

/**
Expand All @@ -64,7 +65,7 @@ class BreakPointCommand extends Command
* BreakPointCommand constructor.
*
* @param BreakPointGenerator $generator
* @param $appRoot
* @param string $appRoot
* @param ThemeHandler $themeHandler
* @param Validator $validator
* @param StringConverter $stringConverter
Expand Down Expand Up @@ -122,11 +123,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$validators = $this->validator;
// we must to ensure theme exist
$machine_name = $validators->validateMachineName($input->getOption('theme'));
$theme_path = $drupal_root . $input->getOption('theme');
$theme = $input->getOption('theme');
$breakpoints = $input->getOption('breakpoints');

$this->generator->generate(
$theme_path,
$theme,
$breakpoints,
$machine_name
);
Expand All @@ -141,23 +142,21 @@ protected function interact(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);

$drupalRoot = $this->appRoot;

// --base-theme option.
$base_theme = $input->getOption('theme');
// --theme option.
$theme = $input->getOption('theme');

if (!$base_theme) {
if (!$theme) {
$themeHandler = $this->themeHandler;
$themes = $themeHandler->rebuildThemeData();
$themes['classy'] ='';
$themes['classy'] = '';

uasort($themes, 'system_sort_modules_by_info_name');

$base_theme = $io->choiceNoList(
$theme = $io->choiceNoList(
$this->trans('commands.generate.breakpoint.questions.theme'),
array_keys($themes)
);
$input->setOption('theme', $base_theme);
$input->setOption('theme', $theme);
}

// --breakpoints option.
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/BreakPointGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public function generate($theme, $breakpoints, $machine_name)
'machine_name' => $machine_name
];

$theme_path = $this->extensionManager->getTheme($theme)->getPath();
$theme_path = $this->extensionManager->getTheme($theme)->getPath();

$this->renderFile(
'theme/breakpoints.yml.twig',
$theme_path .'/'.$machine_name.'.breakpoints.yml',
$theme_path . '/' . $machine_name . '.breakpoints.yml',
$parameters,
FILE_APPEND
);
Expand Down

0 comments on commit 78b6fd8

Please sign in to comment.