当前位置: 首页>>代码示例>>PHP>>正文


PHP DrupalStyle::table方法代码示例

本文整理汇总了PHP中Drupal\Console\Style\DrupalStyle::table方法的典型用法代码示例。如果您正苦于以下问题:PHP DrupalStyle::table方法的具体用法?PHP DrupalStyle::table怎么用?PHP DrupalStyle::table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Console\Style\DrupalStyle的用法示例。


在下文中一共展示了DrupalStyle::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $event_dispatcher = $this->getDrupalService('event_dispatcher');
     $events = array_keys($event_dispatcher->getListeners());
     $event = $input->getArgument('event');
     if ($event) {
         if (!in_array($event, $events)) {
             throw new \Exception(sprintf($this->trans('commands.event.debug.messages.no-events'), $module));
         }
         $dispacher = $event_dispatcher->getListeners($event);
         $listeners = [];
         foreach ($dispacher as $key => $value) {
             $reflection = new \ReflectionClass(get_class($value[0]));
             $listeners[] = [$reflection->getName(), $value[1]];
         }
         $tableHeader = [$this->trans('commands.event.debug.messages.class'), $this->trans('commands.event.debug.messages.method')];
         $tableRows = [];
         foreach ($listeners as $key => $element) {
             $tableRows[] = ['class' => $element['0'], 'method' => $element['1']];
         }
         $io->table($tableHeader, $tableRows);
         return 0;
     }
     $io->table([$this->trans('commands.event.debug.messages.event')], $events);
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:29,代码来源:EventDebugCommand.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $this->get('site')->loadLegacyFile('/core/modules/system/system.module');
     $status = strtolower($input->getOption('status'));
     $type = strtolower($input->getOption('type'));
     $modules = strtolower($input->getArgument('module'));
     if ($modules) {
         $config = $this->getApplication()->getConfig();
         $repo = $config->get('application.composer.repositories.default');
         foreach ($modules as $module) {
             $url = sprintf('%s/packages/drupal/%s.json', $config->get('application.composer.packages.default'), $module);
             try {
                 $data = $this->getApplication()->getHttpClientHelper()->getUrlAsJson($repo . $url);
             } catch (\Exception $e) {
                 $io->error(sprintf($this->trans('commands.module.debug.messages.no-results'), $module));
                 return 1;
             }
             $tableHeader = ['<info>' . $data->package->name . '</info>'];
             $tableRows = [];
             $tableRows[] = [$data->package->description];
             $tableRows[] = ['<comment>' . $this->trans('commands.module.debug.messages.total-downloads') . '</comment>', $data->package->downloads->total];
             $tableRows[] = ['<comment>' . $this->trans('commands.module.debug.messages.total-monthly') . '</comment>', $data->package->downloads->monthly];
             $tableRows[] = ['<comment>' . $this->trans('commands.module.debug.messages.total-daily') . '</comment>', $data->package->downloads->daily];
             $io->table($tableHeader, $tableRows, 'compact');
         }
         return 0;
     }
     if ($status == 'installed') {
         $status = 1;
     } elseif ($status == 'uninstalled') {
         $status = 0;
     } else {
         $status = -1;
     }
     if ($type == 'core') {
         $type = 'core';
     } elseif ($type == 'no-core') {
         $type = '';
     } else {
         $type = null;
     }
     $tableHeader = [$this->trans('commands.module.debug.messages.id'), $this->trans('commands.module.debug.messages.name'), $this->trans('commands.module.debug.messages.package'), $this->trans('commands.module.debug.messages.version'), $this->trans('commands.module.debug.messages.schema-version'), $this->trans('commands.module.debug.messages.status'), $this->trans('commands.module.debug.messages.origin')];
     $tableRows = [];
     $modules = system_rebuild_module_data();
     foreach ($modules as $module_id => $module) {
         if ($status >= 0 && $status != $module->status) {
             continue;
         }
         if ($type !== null && $type !== $module->origin) {
             continue;
         }
         $module_status = $module->status ? $this->trans('commands.module.debug.messages.installed') : $this->trans('commands.module.debug.messages.uninstalled');
         $module_origin = $module->origin ? $module->origin : 'no core';
         $schema_version = drupal_get_installed_schema_version($module_id) != -1 ? drupal_get_installed_schema_version($module_id) : '';
         $tableRows[] = [$module_id, $module->info['name'], $module->info['package'], $module->info['version'], $schema_version, $module_status, $module_origin];
     }
     $io->table($tableHeader, $tableRows, 'compact');
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:59,代码来源:DebugCommand.php

示例3: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $pluginType = $input->getArgument('type');
     $pluginId = $input->getArgument('id');
     // No plugin type specified, show a list of plugin types.
     if (!$pluginType) {
         $tableHeader = [$this->trans('commands.plugin.debug.table-headers.plugin-type-name'), $this->trans('commands.plugin.debug.table-headers.plugin-type-class')];
         $tableRows = [];
         $drupalContainer = $this->getDrupalContainer();
         foreach ($drupalContainer->getServiceIds() as $serviceId) {
             if (strpos($serviceId, 'plugin.manager.') === 0) {
                 $service = $drupalContainer->get($serviceId);
                 $typeName = substr($serviceId, 15);
                 $class = get_class($service);
                 $tableRows[$typeName] = [$typeName, $class];
             }
         }
         ksort($tableRows);
         $io->table($tableHeader, array_values($tableRows));
         return true;
     }
     $service = $this->getDrupalService('plugin.manager.' . $pluginType);
     if (!$service) {
         $io->error(sprintf($this->trans('commands.plugin.debug.errors.plugin-type-not-found'), $pluginType));
         return false;
     }
     // Valid plugin type specified, no ID specified, show list of instances.
     if (!$pluginId) {
         $tableHeader = [$this->trans('commands.plugin.debug.table-headers.plugin-id'), $this->trans('commands.plugin.debug.table-headers.plugin-class')];
         $tableRows = [];
         foreach ($service->getDefinitions() as $definition) {
             $pluginId = $definition['id'];
             $className = $definition['class'];
             $tableRows[$pluginId] = [$pluginId, $className];
         }
         ksort($tableRows);
         $io->table($tableHeader, array_values($tableRows));
         return true;
     }
     // Valid plugin type specified, ID specified, show the definition.
     $definition = $service->getDefinition($pluginId);
     $tableHeader = [$this->trans('commands.plugin.debug.table-headers.definition-key'), $this->trans('commands.plugin.debug.table-headers.definition-value')];
     $tableRows = [];
     foreach ($definition as $key => $value) {
         if (is_object($value) && method_exists($value, '__toString')) {
             $value = (string) $value;
         } elseif (is_array($value) || is_object($value)) {
             $value = Yaml::dump($value);
         } elseif (is_bool($value)) {
             $value = $value ? 'TRUE' : 'FALSE';
         }
         $tableRows[$key] = [$key, $value];
     }
     ksort($tableRows);
     $io->table($tableHeader, array_values($tableRows));
     return true;
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:61,代码来源:PluginDebugCommand.php

示例4: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $service = $input->getArgument('service');
     $tableHeader = [];
     if ($service) {
         $tableRows = $this->getServiceDetail($service);
         $io->table($tableHeader, $tableRows, 'compact');
         return 0;
     }
     $tableHeader = [$this->trans('commands.container.debug.messages.service_id'), $this->trans('commands.container.debug.messages.class_name')];
     $tableRows = $this->getServiceList();
     $io->table($tableHeader, $tableRows, 'compact');
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:17,代码来源:ContainerDebugCommand.php

示例5: execute

 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);
 }
开发者ID:killua99,项目名称:DrupalConsole,代码行数:49,代码来源:DebugCommand.php

示例6: themeDetail

 protected function themeDetail(DrupalStyle $io, $themeId)
 {
     $theme = null;
     $themes = $this->getThemeHandler()->rebuildThemeData();
     if (isset($themes[$themeId])) {
         $theme = $themes[$themeId];
     } else {
         foreach ($themes as $themeAvailableId => $themeAvailable) {
             if ($themeAvailable->info['name'] == $themeId) {
                 $themeId = $themeAvailableId;
                 $theme = $themeAvailable;
                 break;
             }
         }
     }
     if ($theme) {
         $theme = $themes[$themeId];
         $status = $this->getThemeStatus($themeId);
         $io->info($theme->info['name']);
         $io->comment(sprintf('%s : ', $this->trans('commands.theme.debug.messages.status')), false);
         $io->writeln($status);
         $io->comment(sprintf('%s : ', $this->trans('commands.theme.debug.messages.version')), false);
         $io->writeln($theme->info['version']);
         $io->comment($this->trans('commands.theme.debug.messages.regions'));
         $tableRows = $this->addThemeAttributes($theme->info['regions'], $tableRows);
         $io->table([], $tableRows);
     } else {
         $io->error(sprintf($this->trans('commands.theme.debug.messages.invalid-theme'), $themeId));
     }
 }
开发者ID:eleaga,项目名称:DrupalConsole,代码行数:30,代码来源:DebugCommand.php

示例7: execute

 /**
  * {@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');
 }
开发者ID:blasoliva,项目名称:DrupalConsole,代码行数:28,代码来源:DebugCommand.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $environment = $input->getArgument('environment');
     $loadedConfigurations = [];
     if (in_array($environment, array('dev', 'prod'))) {
         $loadedConfigurations = $this->loadConfigurations($environment);
     } else {
         $io->error($this->trans('commands.site.mode.messages.invalid-env'));
     }
     $configurationOverrideResult = $this->overrideConfigurations($loadedConfigurations['configurations']);
     foreach ($configurationOverrideResult as $configName => $result) {
         $io->info($this->trans('commands.site.mode.messages.configuration') . ':', false);
         $io->comment($configName);
         $tableHeader = [$this->trans('commands.site.mode.messages.configuration-key'), $this->trans('commands.site.mode.messages.original'), $this->trans('commands.site.mode.messages.updated')];
         $io->table($tableHeader, $result);
     }
     $servicesOverrideResult = $this->overrideServices($loadedConfigurations['services'], $io);
     if (!empty($servicesOverrideResult)) {
         $io->info($this->trans('commands.site.mode.messages.new-services-settings'));
         $tableHeaders = [$this->trans('commands.site.mode.messages.service'), $this->trans('commands.site.mode.messages.service-parameter'), $this->trans('commands.site.mode.messages.service-value')];
         $io->table($tableHeaders, $servicesOverrideResult);
     }
     $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
 }
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:25,代码来源:ModeCommand.php

示例9: getRouteByNames

 protected function getRouteByNames(DrupalStyle $io, $route_name)
 {
     $routes = $this->routeProvider->getRoutesByNames($route_name);
     foreach ($routes as $name => $route) {
         $tableHeader = [$this->trans('commands.router.debug.messages.route'), '<info>' . $name . '</info>'];
         $tableRows = [];
         $tableRows[] = ['<comment>' . $this->trans('commands.router.debug.messages.path') . '</comment>', $route->getPath()];
         $tableRows[] = ['<comment>' . $this->trans('commands.router.debug.messages.defaults') . '</comment>'];
         $attributes = $this->addRouteAttributes($route->getDefaults());
         foreach ($attributes as $attribute) {
             $tableRows[] = $attribute;
         }
         $tableRows[] = ['<comment>' . $this->trans('commands.router.debug.messages.requirements') . '</comment>'];
         $requirements = $this->addRouteAttributes($route->getRequirements());
         foreach ($requirements as $requirement) {
             $tableRows[] = $requirement;
         }
         $tableRows[] = ['<comment>' . $this->trans('commands.router.debug.messages.options') . '</comment>'];
         $options = $this->addRouteAttributes($route->getOptions());
         foreach ($options as $option) {
             $tableRows[] = $option;
         }
         $io->table($tableHeader, $tableRows, 'compact');
     }
 }
开发者ID:GDrupal,项目名称:DrupalConsole,代码行数:25,代码来源:DebugCommand.php

示例10: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $module_handler = $this->getModuleHandler();
     $io->section($this->trans('commands.cron.debug.messages.module-list'));
     $io->table([$this->trans('commands.cron.debug.messages.module')], $module_handler->getImplementations('cron'), 'compact');
 }
开发者ID:eleaga,项目名称:DrupalConsole,代码行数:7,代码来源:DebugCommand.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $language = $input->getArgument('language');
     $tableHeader = [$this->trans('commands.locale.translation.status.messages.project'), $this->trans('commands.locale.translation.status.messages.version'), $this->trans('commands.locale.translation.status.messages.local-age'), $this->trans('commands.locale.translation.status.messages.remote-age'), $this->trans('commands.locale.translation.status.messages.info')];
     $languages = locale_translatable_language_list();
     $status = locale_translation_get_status();
     $this->getModuleHandler()->loadInclude('locale', 'compare.inc');
     if (!$languages) {
         $io->info($this->trans('commands.locale.translation.status.messages.no-languages'));
         return;
     } elseif (empty($status)) {
         $io->info($this->trans('commands.locale.translation.status.messages.no-translations'));
         return;
     }
     if ($languages) {
         $projectsStatus = $this->projectsStatus();
         foreach ($projectsStatus as $langcode => $rows) {
             $tableRows = [];
             if ($language != '' && !($language == $langcode || strtolower($language) == strtolower($languages[$langcode]->getName()))) {
                 continue;
             }
             $io->info($languages[$langcode]->getName());
             foreach ($rows as $row) {
                 if ($row[0] == 'drupal') {
                     $row[0] = $this->trans('commands.common.messages.drupal-core');
                 }
                 $tableRows[] = $row;
             }
             $io->table($tableHeader, $tableRows, 'compact');
         }
     }
 }
开发者ID:blasoliva,项目名称:DrupalConsole,代码行数:33,代码来源:TranslationStatusCommand.php

示例12: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $vocabularies = $this->getDrupalApi()->getVocabularies();
     // Validate provided vocabularies
     $vids = $input->getArgument('vocabularies');
     $invalidVids = array_filter(array_map(function ($vid) use($vocabularies) {
         if (!isset($vocabularies[$vid])) {
             return $vid;
         } else {
             return null;
         }
     }, $vids));
     if (!empty($invalidVids)) {
         $io->error(sprintf($this->trans('commands.create.terms.messages.invalid-vocabularies'), implode(',', $invalidVids)));
         return;
     }
     $limit = $input->getOption('limit') ?: 10;
     $nameWords = $input->getOption('name-words') ?: 5;
     $createTerms = $this->getDrupalApi()->getCreateTerms();
     $terms = $createTerms->createTerm($vids, $limit, $nameWords);
     $tableHeader = [$this->trans('commands.create.terms.messages.term-id'), $this->trans('commands.create.terms.messages.vocabulary'), $this->trans('commands.create.terms.messages.name')];
     $io->table($tableHeader, $terms['success']);
     $io->success(sprintf($this->trans('commands.create.terms.messages.created-terms'), $limit));
     return;
 }
开发者ID:vielsoft,项目名称:DrupalConsole,代码行数:29,代码来源:TermsCommand.php

示例13: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $io->section($this->trans('commands.event.debug.messages.event-list'));
     $tableHeader = [$this->trans('commands.event.debug.messages.events')];
     $tableRows = $this->getEvents();
     $io->table($tableHeader, $tableRows, 'compact');
 }
开发者ID:void--,项目名称:DrupalConsole,代码行数:11,代码来源:EventDebugCommand.php

示例14: imageStyleList

 /**
  * @param \Drupal\Console\Style\DrupalStyle $io
  * @param $image_handler
  */
 protected function imageStyleList(DrupalStyle $io, $image_handler)
 {
     $tableHeader = [$this->trans('commands.image.styles.debug.messages.styles-name'), $this->trans('commands.image.styles.debug.messages.styles-label')];
     foreach ($image_handler->loadMultiple() as $styles) {
         $tableRows[] = [$styles->get('name'), $styles->get('label')];
     }
     $io->table($tableHeader, $tableRows);
 }
开发者ID:durgeshs,项目名称:DrupalConsole,代码行数:12,代码来源:StylesDebugCommand.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $yaml = new Parser();
     $yaml_left = $input->getArgument('yaml-left');
     $yaml_right = $input->getArgument('yaml-right');
     $stats = $input->getOption('stats');
     $negate = $input->getOption('negate');
     $limit = $input->getOption('limit');
     $offset = $input->getOption('offset');
     if ($negate == 1 || $negate == 'TRUE') {
         $negate = true;
     } else {
         $negate = false;
     }
     try {
         $yamlLeftParsed = $yaml->parse(file_get_contents($yaml_left));
         if (empty($yamlLeftParsed)) {
             $io->error(sprintf($this->trans('commands.yaml.merge.messages.wrong-parse'), $yaml_left));
         }
         $yamlRightParsed = $yaml->parse(file_get_contents($yaml_right));
         if (empty($yamlRightParsed)) {
             $io->error(sprintf($this->trans('commands.yaml.merge.messages.wrong-parse'), $yaml_right));
         }
     } catch (\Exception $e) {
         $io->error($this->trans('commands.yaml.merge.messages.error-parsing') . ': ' . $e->getMessage());
         return;
     }
     $nestedArray = $this->getNestedArrayHelper();
     $statistics = ['total' => 0, 'equal' => 0, 'diff' => 0];
     $diff = $nestedArray->arrayDiff($yamlLeftParsed, $yamlRightParsed, $negate, $statistics);
     if ($stats) {
         $io->info(sprintf($this->trans('commands.yaml.diff.messages.total'), $statistics['total']));
         $io->info(sprintf($this->trans('commands.yaml.diff.messages.diff'), $statistics['diff']));
         $io->info(sprintf($this->trans('commands.yaml.diff.messages.equal'), $statistics['equal']));
         return;
     }
     // FLAT YAML file to display full yaml to be used with command yaml:update:key or yaml:update:value
     $diff_flatten = array();
     $key_flatten = '';
     $nestedArray->yamlFlattenArray($diff, $diff_flatten, $key_flatten);
     if ($limit !== null) {
         if (!$offset) {
             $offset = 0;
         }
         $diff_flatten = array_slice($diff_flatten, $offset, $limit);
     }
     $tableHeader = [$this->trans('commands.yaml.diff.messages.key'), $this->trans('commands.yaml.diff.messages.value')];
     $tableRows = [];
     foreach ($diff_flatten as $yaml_key => $yaml_value) {
         $tableRows[] = [$yaml_key, $yaml_value];
     }
     $io->table($tableHeader, $tableRows, 'compact');
 }
开发者ID:shaktik,项目名称:DrupalConsole,代码行数:54,代码来源:DiffCommand.php


注:本文中的Drupal\Console\Style\DrupalStyle::table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。