Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $application = $this->getApplication();
     $drupal = $this->getDrupalHelper();
     // Provide drupal version if it's installed
     $drupalVersion = $this->trans('commands.site.status.messages.not_installed');
     if ($drupal->isInstalled()) {
         $drupalVersion = sprintf($this->trans('commands.site.status.messages.current_version'), $this->getSite()->getDrupalVersion());
     }
     $aboutTitle = sprintf('%s (%s) | Supports Drupal (%s) | %s', $this->trans('commands.site.status.messages.console'), $application->getVersion(), $application::DRUPAL_SUPPORTED_VERSION, $drupalVersion);
     $io->setDecorated(false);
     $io->title($aboutTitle);
     $io->setDecorated(true);
     $commands = ['init' => [$this->trans('commands.init.description'), 'drupal init --override'], 'quick-start' => [$this->trans('commands.common.messages.quick-start'), 'drupal chain --file=~/.console/chain/quick-start.yml'], 'site-new' => [$this->trans('commands.site.new.description'), sprintf('drupal site:new drupal8.dev %s', $application::DRUPAL_SUPPORTED_VERSION)], 'site-install' => [$this->trans('commands.site.install.description'), sprintf('drupal site:install')], 'links' => [$this->trans('commands.list.description'), 'drupal list']];
     foreach ($commands as $command => $commandInfo) {
         $io->writeln($commandInfo[0]);
         $io->newLine();
         $io->comment(sprintf('  %s', $commandInfo[1]));
         $io->newLine();
     }
     $io->setDecorated(false);
     $io->section($this->trans('commands.self-update.description'));
     $io->setDecorated(true);
     $io->comment('  drupal self-update');
     $io->newLine();
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $nestedArray = $this->getNestedArrayHelper();
     $application = $this->getApplication();
     $config = $application->getConfig();
     $configApplication = $config->get('application');
     unset($configApplication['autowire']);
     unset($configApplication['languages']);
     unset($configApplication['aliases']);
     unset($configApplication['default']);
     $configApplicationFlatten = [];
     $keyFlatten = '';
     $nestedArray->yamlFlattenArray($configApplication, $configApplicationFlatten, $keyFlatten);
     $tableHeader = [$this->trans('commands.settings.debug.messages.config-key'), $this->trans('commands.settings.debug.messages.config-value')];
     $tableRows = [];
     foreach ($configApplicationFlatten as $yamlKey => $yamlValue) {
         $tableRows[] = [$yamlKey, $yamlValue];
     }
     $io->newLine();
     $io->info(sprintf('%s :', $this->trans('commands.settings.debug.messages.config-file')), false);
     $io->comment(sprintf('%s/.console/config.yml', $config->getUserHomeDir()), true);
     $io->newLine();
     $io->table($tableHeader, $tableRows, 'compact');
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $settingKeys = array_keys($this->settings->getAll());
     $io->newLine();
     $io->info($this->trans('commands.config.settings.debug.messages.current'));
     $io->newLine();
     foreach ($settingKeys as $settingKey) {
         $io->comment($settingKey, false);
         $io->simple(Yaml::encode($this->settings->get($settingKey)));
     }
     $io->newLine();
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $settings = $this->getSettings();
     $settingKeys = array_keys($settings->getAll());
     $dumper = new Dumper();
     $io->newLine();
     $io->info($this->trans('commands.settings.debug.messages.current'));
     $io->newLine();
     foreach ($settingKeys as $settingKey) {
         $io->comment($settingKey, false);
         $io->simple($dumper->dump($settings->get($settingKey), 10));
     }
     $io->newLine();
 }
Ejemplo n.º 5
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new DrupalStyle($input, $output);
     $this->getDrupalHelper()->loadLegacyFile('/core/includes/utility.inc');
     $validators = $this->getValidator();
     // Get the --cache option and make validation
     $cache = $input->getArgument('cache');
     $validated_cache = $validators->validateCache($cache);
     if (!$validated_cache) {
         $output->error(sprintf($this->trans('commands.cache.rebuild.messages.invalid_cache'), $cache));
         return;
     }
     // Start rebuilding cache
     $output->newLine();
     $output->writeln(sprintf('<comment>%s</comment>', $this->trans('commands.cache.rebuild.messages.rebuild')));
     // Get data needed to rebuild cache
     $kernelHelper = $this->getKernelHelper();
     $classLoader = $kernelHelper->getClassLoader();
     $request = $kernelHelper->getRequest();
     // Check cache to rebuild
     if ($cache === 'all') {
         // If cache is all, then clear all caches
         drupal_rebuild($classLoader, $request);
     } else {
         // Else, clear the selected cache
         $caches = $validators->getCaches();
         $caches[$cache]->deleteAll();
     }
     $output->success($this->trans('commands.cache.rebuild.messages.completed'));
 }
Ejemplo n.º 6
0
 private function restDetail(DrupalStyle $io, $resource_id)
 {
     $config = $this->getRestDrupalConfig();
     $resourcePluginManager = $this->getPluginManagerRest();
     $plugin = $resourcePluginManager->getInstance(array('id' => $resource_id));
     if (empty($plugin)) {
         $io->error(sprintf($this->trans('commands.rest.debug.messages.not-found'), $resource_id));
         return false;
     }
     $resource = $plugin->getPluginDefinition();
     $configuration = [];
     $configuration[] = [$this->trans('commands.rest.debug.messages.id'), $resource['id']];
     $configuration[] = [$this->trans('commands.rest.debug.messages.label'), (string) $resource['label']];
     $configuration[] = [$this->trans('commands.rest.debug.messages.canonical_url'), $resource['uri_paths']['canonical']];
     $configuration[] = [$this->trans('commands.rest.debug.messages.status'), isset($config[$resource['id']]) ? $this->trans('commands.rest.debug.messages.enabled') : $this->trans('commands.rest.debug.messages.disabled')];
     $configuration[] = [$this->trans('commands.rest.debug.messages.provider', $resource['provider'])];
     $io->comment($resource_id);
     $io->newLine();
     $io->table([], $configuration, 'compact');
     $tableHeader = [$this->trans('commands.rest.debug.messages.rest-state'), $this->trans('commands.rest.debug.messages.supported-formats'), $this->trans('commands.rest.debug.messages.supported_auth')];
     $tableRows = [];
     foreach ($config[$resource['id']] as $method => $settings) {
         $tableRows[] = [$method, implode(', ', $settings['supported_formats']), implode(', ', $settings['supported_auth'])];
     }
     $io->table($tableHeader, $tableRows);
 }
Ejemplo n.º 7
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $io->newLine();
     $io->comment($this->trans('commands.router.rebuild.messages.rebuilding'));
     $this->routerBuilder->rebuild();
     $io->success($this->trans('commands.router.rebuild.messages.completed'));
 }
Ejemplo n.º 8
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new DrupalStyle($input, $output);
     $output->newLine();
     $output->writeln(sprintf('<comment>%s</comment>', $this->trans('commands.router.rebuild.messages.rebuilding')));
     $container = $this->getContainer();
     $router_builder = $container->get('router.builder');
     $router_builder->rebuild();
     $output->success($this->trans('commands.router.rebuild.messages.completed'));
 }
Ejemplo n.º 9
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $image_handler = $this->getService('entity_type.manager')->getStorage('image_style');
     $io->newLine();
     $io->comment($this->trans('commands.image.styles.debug.messages.styles-list'));
     if ($image_handler) {
         $this->imageStyleList($io, $image_handler);
     }
 }
Ejemplo n.º 10
0
 /**
  * {@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;
 }
Ejemplo n.º 11
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new DrupalStyle($input, $output);
     $application = $this->getApplication();
     $aboutTitle = sprintf('%s (%s) | Supports Drupal %s', $this->trans('commands.site.status.messages.console'), $application->getVersion(), $application::DRUPAL_VERSION);
     $output->setDecorated(false);
     $output->title($aboutTitle);
     $output->setDecorated(true);
     $commands = ['init' => [$this->trans('commands.init.description'), 'drupal init [--override]'], 'quick-start' => [$this->trans('commands.common.messages.quick-start'), 'drupal chain --file=~/.console/chain/quick-start.yml'], 'site-new' => [$this->trans('commands.site.new.description'), sprintf('drupal site:new drupal8.dev %s', $application::DRUPAL_VERSION)], 'site-install' => [$this->trans('commands.site.install.description'), sprintf('drupal site:install')], 'links' => [$this->trans('commands.list.description'), 'drupal list']];
     foreach ($commands as $command => $commandInfo) {
         $output->writeln($commandInfo[0]);
         $output->newLine();
         $output->writeln(sprintf('  <comment>%s</comment>', $commandInfo[1]));
         $output->newLine();
     }
     $output->setDecorated(false);
     $output->section($this->trans('commands.self-update.description'));
     $output->setDecorated(true);
     $output->writeln('  <comment>drupal self-update</comment>');
     $output->newLine();
 }
Ejemplo n.º 12
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $directory = $input->getArgument('directory');
     $version = $input->getArgument('version');
     $latest = $input->getOption('latest');
     $composer = $input->getOption('composer');
     if (!$directory) {
         $io->error($this->trans('commands.site.new.messages.missing-directory'));
         return 1;
     }
     if ($composer) {
         if (!$version) {
             $version = '8.x-dev';
         }
         $io->newLine();
         $io->comment(sprintf($this->trans('commands.site.new.messages.executing'), 'drupal', $version));
         $command = sprintf('composer create-project %s:%s %s --no-interaction', 'drupal-composer/drupal-project', $version, $directory);
         $io->commentBlock($command);
         $shellProcess = $this->get('shell_process');
         if ($shellProcess->exec($command)) {
             $io->success(sprintf($this->trans('commands.site.new.messages.composer'), $version, $directory));
             return 0;
         } else {
             return 1;
         }
     }
     if (!$version && $latest) {
         $version = current($this->getApplication()->getDrupalApi()->getProjectReleases('drupal', 1, true));
     }
     if (!$version) {
         $io->error('Missing version');
         return 1;
     }
     $projectPath = $this->downloadProject($io, 'drupal', $version, 'core');
     $downloadPath = sprintf('%sdrupal-%s', $projectPath, $version);
     if ($this->isAbsolutePath($directory)) {
         $copyPath = $directory;
     } else {
         $copyPath = sprintf('%s%s', $projectPath, $directory);
     }
     try {
         $fileSystem = new Filesystem();
         $fileSystem->rename($downloadPath, $copyPath);
     } catch (IOExceptionInterface $e) {
         $io->commentBlock(sprintf($this->trans('commands.site.new.messages.downloaded'), $version, $downloadPath));
         $io->error(sprintf($this->trans('commands.site.new.messages.error-copying'), $e->getPath()));
         return 1;
     }
     $io->success(sprintf($this->trans('commands.site.new.messages.downloaded'), $version, $copyPath));
     return 0;
 }
Ejemplo n.º 13
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $this->get('site')->loadLegacyFile('/core/includes/update.inc');
     $this->get('site')->loadLegacyFile('/core/includes/install.inc');
     $updateRegistry = $this->getDrupalService('update.post_update_registry');
     drupal_load_updates();
     update_fix_compatibility();
     $updates = update_get_update_list();
     $postUpdates = $updateRegistry->getPendingUpdateInformation();
     $requirements = update_check_requirements();
     $severity = drupal_requirements_severity($requirements);
     $io->newLine();
     if ($severity == REQUIREMENT_ERROR || $severity == REQUIREMENT_WARNING) {
         $io->info($this->trans('commands.update.debug.messages.requirements-error'));
         $tableHeader = [$this->trans('commands.update.debug.messages.severity'), $this->trans('commands.update.debug.messages.title'), $this->trans('commands.update.debug.messages.value'), $this->trans('commands.update.debug.messages.description')];
         $tableRows = [];
         foreach ($requirements as $requirement) {
             if (isset($requirement['minimum schema']) & in_array($requirement['minimum schema'], array(REQUIREMENT_ERROR, REQUIREMENT_WARNING))) {
                 $tableRows[] = [$requirement['severity'], $requirement['title'], $requirement['value'], $requirement['description']];
             }
         }
         $io->table($tableHeader, $tableRows);
         return;
     }
     if (empty($updates)) {
         $io->info($this->trans('commands.update.debug.messages.no-updates'));
         return;
     }
     $tableHeader = [$this->trans('commands.update.debug.messages.module'), $this->trans('commands.update.debug.messages.update-n'), $this->trans('commands.update.debug.messages.description')];
     $io->info($this->trans('commands.update.debug.messages.module-list'));
     $tableRows = [];
     foreach ($updates as $module => $module_updates) {
         foreach ($module_updates['pending'] as $update_n => $update) {
             list(, $description) = explode($update_n . " - ", $update);
             $tableRows[] = [$module, $update_n, trim($description)];
         }
     }
     $io->table($tableHeader, $tableRows);
     $tableHeader = [$this->trans('commands.update.debug.messages.module'), $this->trans('commands.update.debug.messages.post-update'), $this->trans('commands.update.debug.messages.description')];
     $io->info($this->trans('commands.update.debug.messages.module-list-post-update'));
     $tableRows = [];
     foreach ($postUpdates as $module => $module_updates) {
         foreach ($module_updates['pending'] as $postUpdateFunction => $message) {
             $tableRows[] = [$module, $postUpdateFunction, $message];
         }
     }
     $io->table($tableHeader, $tableRows);
 }
Ejemplo n.º 14
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $io->newLine();
     $io->comment($this->trans('commands.node.access.rebuild.messages.rebuild'));
     $batch = $input->getOption('batch');
     try {
         node_access_rebuild($batch);
     } catch (\Exception $e) {
         $io->error($e->getMessage());
         return;
     }
     $needs_rebuild = $this->getState()->get('node.node_access_needs_rebuild') ?: false;
     if ($needs_rebuild) {
         $io->warning($this->trans('commands.node.access.rebuild.messages.failed'));
     } else {
         $io->success($this->trans('commands.node.access.rebuild.messages.completed'));
     }
 }
Ejemplo n.º 15
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $cache = $input->getArgument('cache');
     $this->site->loadLegacyFile('/core/includes/utility.inc');
     if ($cache && !$this->drupalApi->isValidCache($cache)) {
         $io->error(sprintf($this->trans('commands.cache.rebuild.messages.invalid_cache'), $cache));
         return 1;
     }
     $io->newLine();
     $io->comment($this->trans('commands.cache.rebuild.messages.rebuild'));
     if ($cache === 'all') {
         drupal_rebuild($this->classLoader, $this->requestStack->getCurrentRequest());
     } else {
         $caches = $this->drupalApi->getCaches();
         $caches[$cache]->deleteAll();
     }
     $io->success($this->trans('commands.cache.rebuild.messages.completed'));
     return 0;
 }
Ejemplo n.º 16
0
 /**
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $this->get('site')->loadLegacyFile('/core/includes/update.inc');
     $this->get('site')->loadLegacyFile('/core/includes/install.inc');
     drupal_load_updates();
     update_fix_compatibility();
     $requirements = update_check_requirements();
     $severity = drupal_requirements_severity($requirements);
     $updates = update_get_update_list();
     $io->newLine();
     if ($severity == REQUIREMENT_ERROR || $severity == REQUIREMENT_WARNING) {
         $this->populateRequirements($io, $requirements);
     } elseif (empty($updates)) {
         $io->info($this->trans('commands.update.debug.messages.no-updates'));
     } else {
         $this->populateUpdate($io, $updates);
         $this->populatePostUpdate($io);
     }
 }
Ejemplo n.º 17
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     //Registers namespaces for disabled modules.
     $this->getTestDiscovery()->registerTestNamespaces();
     $testClass = $input->getArgument('test-class');
     $url = $input->getOption('url');
     if (!$url) {
         $io->error($this->trans('commands.test.run.messages.url-required'));
         return;
     }
     $this->setEnvironment($url);
     // Create simpletest test id
     $testId = db_insert('simpletest_test_id')->useDefaults(array('test_id'))->execute();
     if (is_subclass_of($testClass, 'PHPUnit_Framework_TestCase')) {
         $io->info($this->trans('commands.test.run.messages.phpunit-pending'));
         return;
     } else {
         $test = new $testClass($testId);
         $io->info($this->trans('commands.test.run.messages.starting-test'));
         Timer::start('run-tests');
         $test->run();
         $end = Timer::stop('run-tests');
         $io->simple($this->trans('commands.test.run.messages.test-duration') . ': ' . \Drupal::service('date.formatter')->formatInterval($end['time'] / 1000));
         $io->simple($this->trans('commands.test.run.messages.test-pass') . ': ' . $test->results['#pass']);
         $io->commentBlock($this->trans('commands.test.run.messages.test-fail') . ': ' . $test->results['#fail']);
         $io->commentBlock($this->trans('commands.test.run.messages.test-exception') . ': ' . $test->results['#exception']);
         $io->simple($this->trans('commands.test.run.messages.test-debug') . ': ' . $test->results['#debug']);
         $this->getModuleHandler()->invokeAll('test_finished', array($test->results));
         $io->newLine();
         $io->info($this->trans('commands.test.run.messages.test-summary'));
         $io->newLine();
         $currentClass = null;
         $currentGroup = null;
         $currentStatus = null;
         $messages = $this->simpletestScriptLoadMessagesByTestIds(array($testId));
         foreach ($messages as $message) {
             if ($currentClass === null || $currentClass != $message->test_class) {
                 $currentClass = $message->test_class;
                 $io->comment($message->test_class);
             }
             if ($currentGroup === null || $currentGroup != $message->message_group) {
                 $currentGroup = $message->message_group;
             }
             if ($currentStatus === null || $currentStatus != $message->status) {
                 $currentStatus = $message->status;
                 if ($message->status == 'fail') {
                     $io->error($this->trans('commands.test.run.messages.group') . ':' . $message->message_group . ' ' . $this->trans('commands.test.run.messages.status') . ':' . $message->status);
                     $io->newLine();
                 } else {
                     $io->info($this->trans('commands.test.run.messages.group') . ':' . $message->message_group . ' ' . $this->trans('commands.test.run.messages.status') . ':' . $message->status);
                     $io->newLine();
                 }
             }
             $io->simple($this->trans('commands.test.run.messages.file') . ': ' . str_replace($this->getDrupalHelper()->getRoot(), '', $message->file));
             $io->simple($this->trans('commands.test.run.messages.method') . ': ' . $message->function);
             $io->simple($this->trans('commands.test.run.messages.line') . ': ' . $message->line);
             $io->simple($this->trans('commands.test.run.messages.message') . ': ' . $message->message);
             $io->newLine();
         }
         return;
     }
 }
Ejemplo n.º 18
0
 protected function showDataAsTable(DrupalStyle $io, $siteData)
 {
     if (empty($siteData)) {
         return [];
     }
     $io->newLine();
     foreach ($this->groups as $group) {
         $tableRows = [];
         $groupData = $siteData[$group];
         $io->comment($this->trans('commands.site.status.messages.' . $group));
         foreach ($groupData as $key => $item) {
             $tableRows[] = [$key, $item];
         }
         $io->table([], $tableRows, 'compact');
     }
 }
Ejemplo n.º 19
0
 /**
  * @param DrupalStyle $io
  * @param string      $file
  * @param int         $index
  */
 private function showFile(DrupalStyle $io, $file, $index)
 {
     $io->info(sprintf('%s -', $index), false);
     $io->comment($file, false);
     $io->newLine();
 }
Ejemplo n.º 20
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // Retrieve whether detailed option has been selected.
     $detailedOutput = $input->getOption('detailed');
     // Retrieve whether an entity type has been specified.
     $entityTypeOption = $input->getOption('entity');
     // Retrieve whether a specific bundle type has been specified.
     $bundleTypeOption = $input->getOption('bundle');
     $entityList = $this->entityTypeManager->getDefinitions();
     $allFields = $this->entityFieldManager->getFieldMap();
     // Set a flag so we can error if a specific entity type selected but not found.
     $entityTypeOptionFound = false;
     // Set a flag so we can error if a specific bundle type selected but not found.
     $bundleTypeOptionFound = false;
     // Let's count the fields found so we can display a message if none found.
     $fieldCounter = 0;
     foreach ($entityList as $entityTypeId => $entityValue) {
         // If the Entity has bundleEntityType set we grab it.
         $bundleEntityType = $entityValue->get('bundle_entity_type');
         // Check to see if the entity has any bundle before continuing.
         if (!empty($bundleEntityType)) {
             $bundleTypes = $this->entityTypeManager->getStorage($bundleEntityType)->loadMultiple();
             // If a specific entity type has been selected and this is it then we continue else we skip.
             if ((!empty($entityTypeOption) && $entityTypeOption == $entityTypeId) | empty($entityTypeOption)) {
                 // Store the fact that we found the entity type specified so we can error if not found.
                 $entityTypeOptionFound = true;
                 // Get the entity type label.
                 $bundleParent = $entityValue->get('label');
                 // Using counter to know whether to output header.
                 $bundleTypeCounter = 0;
                 foreach ($bundleTypes as $bundleType) {
                     // If a specific bundle type has been selected and this is it then we continue else we skip.
                     if ((!empty($bundleTypeOption) && $bundleTypeOption == $bundleType->id()) | empty($bundleTypeOption)) {
                         // Store the fact that we found the bundle type specified so we can error if not found.
                         $bundleTypeOptionFound = true;
                         // Increase the bundle type counter so we know whether to output header.
                         $bundleTypeCounter++;
                         if ($bundleTypeCounter == 1) {
                             // Output the Parent Entity label if we haven't already.
                             if ($detailedOutput) {
                                 // If detailed output then display the id as well.
                                 $io->info(strtoupper($bundleParent) . ' (' . $entityTypeId . '):');
                             } else {
                                 // otherwise just display the label for normal output.
                                 $io->info(strtoupper($bundleParent . ':'));
                             }
                             $io->newLine();
                         }
                         // Load in the entityType fields.
                         $fields = $this->getBundleFields($entityTypeId, $bundleType->id());
                         foreach ($fields as $field => $fieldArray) {
                             // We found a field so increase the field counter.
                             $fieldCounter++;
                             // Get the related / used in bundles from the field.
                             $relatedBundles = "";
                             $relatedBundlesArray = $allFields[$entityTypeId][$field]['bundles'];
                             // Turn those related / used in bundles array into a string.
                             foreach ($relatedBundlesArray as $relatedBundlesValue) {
                                 if ($bundleTypes[$relatedBundlesValue]->id() != $bundleType->id()) {
                                     if (!empty($relatedBundles)) {
                                         $relatedBundles .= ', ' . $bundleTypes[$relatedBundlesValue]->label();
                                     } else {
                                         $relatedBundles = $bundleTypes[$relatedBundlesValue]->label();
                                     }
                                 }
                             }
                             // Build out our table for the fields.
                             $tableRows[] = $detailedOutput ? [$fieldArray->get('label'), $fieldArray->get('field_type'), $fieldArray->get('description'), $relatedBundles] : [$fieldArray->get('label'), $fieldArray->get('field_type'), $relatedBundles];
                             // Clear the related bundles ready for the next field.
                             unset($relatedBundles);
                         }
                         // If detailed output then display bundle id and description.
                         if ($detailedOutput) {
                             // Output the bundle label and id.
                             $io->info($bundleType->label() . ' (' . $bundleType->id() . ')');
                             $io->info(strip_tags($bundleType->get('description')));
                         } else {
                             // Else just output the bundle label.
                             $io->info($bundleType->label());
                         }
                         // Fill out our table header.
                         // If no rows exist for the fields then we display a no results message.
                         if (!empty($tableRows)) {
                             $tableHeader = $detailedOutput ? [$this->trans('commands.field.info.table.header-name'), $this->trans('commands.field.info.table.header-type'), $this->trans('commands.field.info.table.header-desc'), $this->trans('commands.field.info.table.header-usage')] : [$this->trans('commands.field.info.table.header-name'), $this->trans('commands.field.info.table.header-type'), $this->trans('commands.field.info.table.header-usage')];
                             $io->table($tableHeader, $tableRows);
                         } else {
                             $io->comment($this->trans('commands.field.info.messages.fields-none') . ' ' . $this->trans('commands.field.info.messages.in-bundle-type') . " '" . $bundleType->label() . "'");
                         }
                         // Clear out the rows & headers arrays to start fresh.
                         unset($tableHeader, $tableRows);
                         // Create some space so the output looks nice.
                         $io->newLine();
                     }
                 }
             }
         }
     }
     // If entity type was specified but not found then display error message.
     if (!empty($entityTypeOption)) {
         if (!$entityTypeOptionFound) {
             $io->comment($this->trans('commands.field.info.messages.entity-type') . ' ' . $entityTypeOption . ' ' . $this->trans('commands.field.info.messages.not-found'));
         } elseif (!empty($bundleTypeOption) && !$bundleTypeOptionFound) {
             // If specified entity type found and bundle type specified but not found then display error message.
             $io->comment($this->trans('commands.field.info.messages.bundle-type') . ' ' . $bundleTypeOption . ' ' . $this->trans('commands.field.info.messages.not-found') . ' ' . $this->trans('commands.field.info.messages.in-entity-type') . ' ' . $entityTypeOption);
         }
     } elseif (!empty($bundleTypeOption) && !$bundleTypeOptionFound) {
         // If specified bundle type not found then display error message.
         $io->comment($this->trans('commands.field.info.messages.bundle-type') . ' ' . $bundleTypeOption . ' ' . $this->trans('commands.field.info.messages.not-found'));
     } elseif ($fieldCounter == 0) {
         // If no fields found then display appropriate message.
         $io->comment($this->trans('commands.field.info.messages.fields-none'));
     }
     return 0;
 }