• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Style\DrupalStyle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: interact

 /**
  * {@inheritdoc}
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($output);
         $input->setOption('module', $module);
     }
     // --name option
     $name = $input->getOption('name');
     if (!$name) {
         $name = $io->ask($this->trans('commands.generate.twig.extension.questions.twig-extension'), $module . '.twig.extension');
         $input->setOption('name', $name);
     }
     // --class option
     $class = $input->getOption('class');
     if (!$class) {
         $class = $io->ask($this->trans('commands.common.options.class'), 'DefaultTwigExtension');
         $input->setOption('class', $class);
     }
     // --services option
     $services = $input->getOption('services');
     if (!$services) {
         // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion
         $services = $this->servicesQuestion($output);
         $input->setOption('services', $services);
     }
 }
开发者ID:jlbellido,项目名称:DrupalConsole,代码行数:33,代码来源:TwigExtensionCommand.php


示例2: interact

 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($output);
         $input->setOption('module', $module);
     }
     // --class option
     $class = $input->getOption('class');
     if (!$class) {
         $class = $io->ask($this->trans('commands.generate.plugin.mail.options.class'), 'HtmlFormatterMail', function ($class) {
             return $this->validateClassName($class);
         });
         $input->setOption('class', $class);
     }
     // --label option
     $label = $input->getOption('label');
     if (!$label) {
         $label = $io->ask($this->trans('commands.generate.plugin.mail.options.label'), $this->getStringHelper()->camelCaseToHuman($class));
         $input->setOption('label', $label);
     }
     // --plugin-id option
     $pluginId = $input->getOption('plugin-id');
     if (!$pluginId) {
         $pluginId = $io->ask($this->trans('commands.generate.plugin.mail.options.plugin-id'), $this->getStringHelper()->camelCaseToUnderscore($class));
         $input->setOption('plugin-id', $pluginId);
     }
     // --services option
     // @see Drupal\Console\Command\ServicesTrait::servicesQuestion
     $services = $this->servicesQuestion($output);
     $input->setOption('services', $services);
 }
开发者ID:durgeshs,项目名称:DrupalConsole,代码行数:35,代码来源:PluginMailCommand.php


示例3: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $tableHeader = [$this->trans('commands.queue.debug.messages.queue'), $this->trans('commands.queue.debug.messages.items'), $this->trans('commands.queue.debug.messages.class')];
     $tableBody = $this->listQueues();
     $io->table($tableHeader, $tableBody);
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:10,代码来源:DebugCommand.php


示例4: interact

 /**
  * {@inheritdoc}
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $validator_filename = function ($value) use($io) {
         if (!strlen(trim($value)) || !is_file($value)) {
             $io->error($this->trans('commands.common.errors.invalid-file-path'));
             return false;
         }
         return $value;
     };
     // --yaml-left option
     $yaml_left = $input->getArgument('yaml-left');
     if (!$yaml_left) {
         while (true) {
             $yaml_left = $output->ask($this->trans('commands.yaml.diff.questions.yaml-left'), null, $validator_filename);
             if ($yaml_left) {
                 break;
             }
         }
         $input->setArgument('yaml-left', $yaml_left);
     }
     // --yaml-right option
     $yaml_right = $input->getArgument('yaml-right');
     if (!$yaml_right) {
         while (true) {
             $yaml_right = $output->ask($this->trans('commands.yaml.diff.questions.yaml-right'), null, $validator_filename);
             if ($yaml_right) {
                 break;
             }
         }
         $input->setArgument('yaml-right', $yaml_right);
     }
 }
开发者ID:shaktik,项目名称:DrupalConsole,代码行数:36,代码来源:DiffCommand.php


示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $moduleHandler = $this->moduleHandler;
     $moduleHandler->loadInclude('locale', 'inc', 'locale.translation');
     $moduleHandler->loadInclude('locale', 'module');
     $language = $input->getArgument('language');
     $languagesObjects = locale_translatable_language_list();
     $languages = $this->site->getStandardLanguages();
     if (isset($languagesObjects[$language])) {
         $languageEntity = $languagesObjects[$language];
     } elseif (array_search($language, $languages)) {
         $langcode = array_search($language, $languages);
         $languageEntity = $languagesObjects[$langcode];
     } else {
         $io->error(sprintf($this->trans('commands.locale.language.delete.messages.invalid-language'), $language));
         return 1;
     }
     try {
         $configurable_language_storage = $this->entityTypeManager->getStorage('configurable_language');
         $configurable_language_storage->load($languageEntity->getId())->delete();
         $io->info(sprintf($this->trans('commands.locale.language.delete.messages.language-deleted-successfully'), $languageEntity->getName()));
     } catch (\Exception $e) {
         $io->error($e->getMessage());
         return 1;
     }
     return 0;
 }
开发者ID:ranqiangjun,项目名称:DrupalConsole,代码行数:28,代码来源:LanguageDeleteCommand.php


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


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


示例8: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /**
      * DrupalConsole extends the SymfonyStyle class to provide
      * an standardized Output Formatting Style.
      *
      * Drupal Console provides the DrupalStyle helper class:
      */
     $io = new DrupalStyle($input, $output);
     $io->simple('This text could be translatable by');
     $io->simple('adding a YAML file at "config/translations/LANGUAGE/command.name.yml"');
     /**
      *  By using ContainerAwareCommand as the base class for the command
      *  (instead of the more basic Command), you have access to
      *  the service container.
      *
      *  In other words, you can access to any configured Drupal service
      *  using the provided getService method.
      *
      *  $this->getService('entity_type.manager');
      *
      *  Reading user input argument
      *  $input->getArgument('ARGUMENT_NAME');
      *
      *  Reading user input option
      *  $input->getOption('OPTION_NAME');
      */
 }
开发者ID:durgeshs,项目名称:DrupalConsole,代码行数:31,代码来源:ExampleCommand.php


示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $resource_id = $input->getArgument('resource-id');
     $rest_resources = $this->getRestResources();
     $rest_resources_ids = array_merge(array_keys($rest_resources['enabled']), array_keys($rest_resources['disabled']));
     if (!$resource_id) {
         $resource_id = $io->choiceNoList($this->trans('commands.rest.enable.arguments.resource-id'), $rest_resources_ids);
     }
     $this->validateRestResource($resource_id, $rest_resources_ids, $this->translator);
     $input->setArgument('resource-id', $resource_id);
     // Calculate states available by resource and generate the question.
     $plugin = $this->pluginManagerRest->getInstance(['id' => $resource_id]);
     $methods = $plugin->availableMethods();
     $method = $io->choice($this->trans('commands.rest.enable.arguments.methods'), $methods);
     $io->writeln($this->trans('commands.rest.enable.messages.selected-method') . ' ' . $method);
     $format = $io->choice($this->trans('commands.rest.enable.arguments.formats'), $this->formats);
     $io->writeln($this->trans('commands.rest.enable.messages.selected-format') . ' ' . $format);
     // Get Authentication Provider and generate the question
     $authenticationProviders = $this->authenticationCollector->getSortedProviders();
     $authenticationProvidersSelected = $io->choice($this->trans('commands.rest.enable.messages.authentication-providers'), array_keys($authenticationProviders), 0, true);
     $io->writeln($this->trans('commands.rest.enable.messages.selected-authentication-providers') . ' ' . implode(', ', $authenticationProvidersSelected));
     $format_resource_id = str_replace(':', '.', $resource_id);
     $config = $this->entityManager->getStorage('rest_resource_config')->load($format_resource_id);
     if (!$config) {
         $config = $this->entityManager->getStorage('rest_resource_config')->create(['id' => $format_resource_id, 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, 'configuration' => []]);
     }
     $configuration = $config->get('configuration') ?: [];
     $configuration[$method] = ['supported_formats' => [$format], 'supported_auth' => $authenticationProvidersSelected];
     $config->set('configuration', $configuration);
     $config->save();
     $message = sprintf($this->trans('commands.rest.enable.messages.success'), $resource_id);
     $io->info($message);
     return true;
 }
开发者ID:GDrupal,项目名称:DrupalConsole,代码行数:35,代码来源:EnableCommand.php


示例10: clearEvents

 /**
  * @param \Drupal\Console\Style\DrupalStyle $io
  * @param $eventType
  * @param $eventSeverity
  * @param $userId
  * @return bool
  */
 protected function clearEvents(DrupalStyle $io, $eventType, $eventSeverity, $userId)
 {
     $connection = $this->getDatabase();
     $severity = RfcLogLevel::getLevels();
     $query = $connection->delete('watchdog');
     if ($eventType) {
         $query->condition('type', $eventType);
     }
     if ($eventSeverity) {
         if (!in_array($eventSeverity, $severity)) {
             $io->error(sprintf($this->trans('commands.database.log.clear.messages.invalid-severity'), $eventSeverity));
             return false;
         }
         $query->condition('severity', array_search($eventSeverity, $severity));
     }
     if ($userId) {
         $query->condition('uid', $userId);
     }
     $result = $query->execute();
     if (!$result) {
         $io->error($this->trans('commands.database.log.clear.messages.clear-error'));
         return false;
     }
     $io->success($this->trans('commands.database.log.clear.messages.clear-sucess'));
     return true;
 }
开发者ID:blasoliva,项目名称:DrupalConsole,代码行数:33,代码来源:LogClearCommand.php


示例11: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $learning = $input->hasOption('learning') ? $input->getOption('learning') : false;
     $address = $input->getArgument('address');
     if (false === strpos($address, ':')) {
         $address = sprintf('%s:8088', $address);
     }
     $finder = new PhpExecutableFinder();
     if (false === ($binary = $finder->find())) {
         $io->error($this->trans('commands.server.errors.binary'));
         return;
     }
     $router = $this->getRouterPath();
     $cli = sprintf('%s %s %s %s', $binary, '-S', $address, $router);
     if ($learning) {
         $io->commentBlock($cli);
     }
     $io->success(sprintf($this->trans('commands.server.messages.executing'), $binary));
     $processBuilder = new ProcessBuilder(explode(' ', $cli));
     $process = $processBuilder->getProcess();
     $process->setWorkingDirectory($this->get('site')->getRoot());
     $process->setTty('true');
     $process->run();
     if (!$process->isSuccessful()) {
         $io->error($process->getErrorOutput());
     }
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:31,代码来源:ServerCommand.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);
     $styles = $input->getArgument('styles');
     $result = 0;
     $imageStyle = $this->entityTypeManager->getStorage('image_style');
     $stylesNames = [];
     if (in_array('all', $styles)) {
         $styles = $imageStyle->loadMultiple();
         foreach ($styles as $style) {
             $stylesNames[] = $style->get('name');
         }
         $styles = $stylesNames;
     }
     foreach ($styles as $style) {
         try {
             $io->info(sprintf($this->trans('commands.image.styles.flush.messages.executing-flush'), $style));
             $imageStyle->load($style)->flush();
         } catch (\Exception $e) {
             watchdog_exception('image', $e);
             $io->error($e->getMessage());
             $result = 1;
         }
     }
     $io->success($this->trans('commands.image.styles.flush.messages.success'));
     return $result;
 }
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:30,代码来源:StylesFlushCommand.php


示例14: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $moduleHandler = $this->moduleHandler;
     $moduleHandler->loadInclude('locale', 'inc', 'locale.translation');
     $moduleHandler->loadInclude('locale', 'module');
     $language = $input->getArgument('language');
     $languages = $this->site->getStandardLanguages();
     if (isset($languages[$language])) {
         $langcode = $language;
     } elseif (array_search($language, $languages)) {
         $langcode = array_search($language, $languages);
     } else {
         $io->error(sprintf($this->trans('commands.locale.language.add.messages.invalid-language'), $language));
         return 1;
     }
     try {
         $language = ConfigurableLanguage::createFromLangcode($langcode);
         $language->type = LOCALE_TRANSLATION_REMOTE;
         $language->save();
         $io->info(sprintf($this->trans('commands.locale.language.add.messages.language-add-successfully'), $language->getName()));
     } catch (\Exception $e) {
         $io->error($e->getMessage());
         return 1;
     }
     return 0;
 }
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:27,代码来源:LanguageAddCommand.php


示例15: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $uid = $input->getArgument('uid');
     $account = User::load($uid);
     if (!$account) {
         // Error loading User entity.
         $io->error(sprintf($this->trans('commands.user.login.clear.attempts.errors.invalid-user'), $uid));
         return 1;
     }
     // Define event name and identifier.
     $event = 'user.failed_login_user';
     // Identifier is created by uid and IP address,
     // Then we defined a generic identifier.
     $identifier = "{$account->id()}-";
     // Retrieve current database connection.
     $database = $this->getDrupalService('database');
     $schema = $database->schema();
     $flood = $schema->findTables('flood');
     if (!$flood) {
         $io->error($this->trans('commands.user.login.clear.attempts.errors.no-flood'));
         return 1;
     }
     // Clear login attempts.
     $database->delete('flood')->condition('event', $event)->condition('identifier', $database->escapeLike($identifier) . '%', 'LIKE')->execute();
     // Command executed successful.
     $io->success(sprintf($this->trans('commands.user.login.clear.attempts.messages.successful'), $uid));
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:31,代码来源:LoginCleanAttemptsCommand.php


示例16: interact

 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($output);
         $input->setOption('module', $module);
     }
     // --class option
     $class_name = $input->getOption('class');
     if (!$class_name) {
         $class_name = $io->ask($this->trans('commands.generate.plugin.type.annotation.options.class'), 'ExamplePlugin');
         $input->setOption('class', $class_name);
     }
     // --machine-name option
     $machine_name = $input->getOption('machine-name');
     if (!$machine_name) {
         $machine_name = $io->ask($this->trans('commands.generate.plugin.type.annotation.options.machine-name'), $this->getStringHelper()->camelCaseToUnderscore($class_name));
         $input->setOption('machine-name', $machine_name);
     }
     // --label option
     $label = $input->getOption('label');
     if (!$label) {
         $label = $output->ask($this->trans('commands.generate.plugin.type.annotation.options.label'), $this->getStringHelper()->camelCaseToHuman($class_name));
         $input->setOption('label', $label);
     }
 }
开发者ID:blasoliva,项目名称:DrupalConsole,代码行数:29,代码来源:PluginTypeAnnotationCommand.php


示例17: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $roles = $input->getOption('roles');
     $limit = $input->getOption('limit');
     $entityManager = $this->getEntityManager();
     $userStorage = $entityManager->getStorage('user');
     $systemRoles = $this->getDrupalApi()->getRoles();
     $entityQuery = $this->getEntityQuery();
     $query = $entityQuery->get('user');
     $query->condition('uid', 0, '>');
     $query->sort('uid');
     if ($roles) {
         $query->condition('roles', is_array($roles) ? $roles : [$roles], 'IN');
     }
     if ($limit) {
         $query->range(0, $limit);
     }
     $results = $query->execute();
     $users = $userStorage->loadMultiple($results);
     $tableHeader = [$this->trans('commands.user.debug.messages.user-id'), $this->trans('commands.user.debug.messages.username'), $this->trans('commands.user.debug.messages.roles'), $this->trans('commands.user.debug.messages.status')];
     $tableRows = [];
     foreach ($users as $userId => $user) {
         $userRoles = [];
         foreach ($user->getRoles() as $userRole) {
             $userRoles[] = $systemRoles[$userRole];
         }
         $status = $user->isActive() ? $this->trans('commands.common.status.enabled') : $this->trans('commands.common.status.disabled');
         $tableRows[] = [$userId, $user->getUsername(), implode(', ', $userRoles), $status];
     }
     $io->table($tableHeader, $tableRows);
 }
开发者ID:blasoliva,项目名称:DrupalConsole,代码行数:35,代码来源:DebugCommand.php


示例18: interact

 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($output);
         $input->setOption('module', $module);
     }
     // --class option
     $class_name = $input->getOption('class');
     if (!$class_name) {
         $class_name = $io->ask($this->trans('commands.generate.plugin.imageeffect.questions.class'), 'DefaultImageEffect');
         $input->setOption('class', $class_name);
     }
     // --label option
     $label = $input->getOption('label');
     if (!$label) {
         $label = $io->ask($this->trans('commands.generate.plugin.imageeffect.questions.label'), $this->getStringHelper()->camelCaseToHuman($class_name));
         $input->setOption('label', $label);
     }
     // --plugin-id option
     $plugin_id = $input->getOption('plugin-id');
     if (!$plugin_id) {
         $plugin_id = $io->ask($this->trans('commands.generate.plugin.imageeffect.questions.plugin-id'), $this->getStringHelper()->camelCaseToUnderscore($class_name));
         $input->setOption('plugin-id', $plugin_id);
     }
     // --description option
     $description = $input->getOption('description');
     if (!$description) {
         $description = $io->ask($this->trans('commands.generate.plugin.imageeffect.questions.description'), 'My Image Effect');
         $input->setOption('description', $description);
     }
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:35,代码来源:PluginImageEffectCommand.php


示例19: interact

 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($output);
         $input->setOption('module', $module);
     }
     // --class option
     $class_name = $input->getOption('class');
     if (!$class_name) {
         $class_name = $io->ask($this->trans('commands.generate.plugin.type.yaml.options.class'), 'ExamplePlugin');
         $input->setOption('class', $class_name);
     }
     // --plugin-name option
     $plugin_name = $input->getOption('plugin-name');
     if (!$plugin_name) {
         $plugin_name = $io->ask($this->trans('commands.generate.plugin.type.yaml.options.plugin-name'), $this->getStringHelper()->camelCaseToUnderscore($class_name));
         $input->setOption('plugin-name', $plugin_name);
     }
     // --plugin-file-name option
     $plugin_file_name = $input->getOption('plugin-file-name');
     if (!$plugin_file_name) {
         $plugin_file_name = $io->ask($this->trans('commands.generate.plugin.type.yaml.options.plugin-file-name'), strtr($plugin_name, '_-', '..'));
         $input->setOption('plugin-file-name', $plugin_file_name);
     }
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:29,代码来源:PluginTypeYamlCommand.php


示例20: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $language = $input->getArgument('language');
     $format = $input->getOption('format');
     $application = $this->getApplication();
     $appRoot = $application->getDirectoryRoot();
     $languages = $application->getConfig()->get('application.languages');
     unset($languages['en']);
     if ($language && !isset($languages[$language])) {
         $io->error(sprintf($this->trans('commands.translation.stats.messages.invalid-language'), $language));
         return 1;
     }
     if ($language) {
         $languages = [$language => $languages[$language]];
     }
     $stats = $this->calculateStats($io, $language, $languages, $appRoot);
     if ($format == 'table') {
         $tableHeaders = [$this->trans('commands.translation.stats.messages.language'), $this->trans('commands.translation.stats.messages.percentage'), $this->trans('commands.translation.stats.messages.iso')];
         $io->table($tableHeaders, $stats);
         return 0;
     }
     if ($format == 'markdown') {
         $arguments['language'] = $this->trans('commands.translation.stats.messages.language');
         $arguments['percentage'] = $this->trans('commands.translation.stats.messages.percentage');
         $arguments['languages'] = $stats;
         $io->writeln($this->getRenderHelper()->render('core/translation/stats.md.twig', $arguments));
     }
 }
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:32,代码来源:TranslationStatsCommand.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Core\DrupalKernel类代码示例发布时间:2022-05-23
下一篇:
PHP Utility\Xss类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap