entityTypeManager = $entityTypeManager; parent::__construct(); } /** * {@inheritdoc} */ protected function configure() { $this ->setName('image:styles:debug') ->setDescription($this->trans('commands.image.styles.debug.description')); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $imageStyle = $this->entityTypeManager->getStorage('image_style'); $io->newLine(); $io->comment( $this->trans('commands.image.styles.debug.messages.styles-list') ); if ($imageStyle) { $this->imageStyleList($io, $imageStyle); } return 0; } /** * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $imageStyle */ protected function imageStyleList(DrupalStyle $io, $imageStyle) { $tableHeader = [ $this->trans('commands.image.styles.debug.messages.styles-name'), $this->trans('commands.image.styles.debug.messages.styles-label') ]; $tableRows = []; foreach ($imageStyle->loadMultiple() as $styles) { $tableRows[] = [ $styles->get('name'), $styles->get('label') ]; } $io->table( $tableHeader, $tableRows ); } }