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


PHP DrupalStyle::newLine方法代码示例

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


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

示例1: execute

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

示例2: 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

示例3: execute

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

示例4: execute

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

示例5: execute

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

示例6: restDetail

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

示例7: execute

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

示例8: execute

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

示例9: execute

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

示例10: execute

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

示例11: execute

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

示例12: execute

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

示例13: 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

示例14: execute

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

示例15: execute

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


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