breakpointManager = $breakpointManager; $this->appRoot = $appRoot; parent::__construct(); } /** * {@inheritdoc} */ protected function configure() { $this ->setName('breakpoints:debug') ->setDescription($this->trans('commands.breakpoints.debug.description')) ->addArgument( 'group', InputArgument::OPTIONAL, $this->trans('commands.breakpoints.debug.options.group-name') ); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $group = $input->getArgument('group'); if ($group) { $breakPointData = $this->getBreakpointByName($group); foreach ($breakPointData as $key => $breakPoint) { $io->comment($key, false); $io->block(Yaml::dump($breakPoint)); } return 0; } $groups = array_keys($this->breakpointManager->getGroups()); $tableHeader = [ $this->trans('commands.breakpoints.debug.messages.name'), ]; $io->table($tableHeader, $groups, 'compact'); return 0; } /** * @param $group String * @return mixed */ private function getBreakpointByName($group) { $typeExtension = implode( ',', array_values($this->breakpointManager->getGroupProviders($group)) ); if ($typeExtension == 'theme') { $projectPath = drupal_get_path('theme', $group); } if ($typeExtension == 'module') { $projectPath = drupal_get_path('module', $group); } $extensionFile = sprintf( '%s/%s/%s.breakpoints.yml', $this->appRoot, $projectPath, $group ); return Yaml::parse( file_get_contents($extensionFile) ); } }