/** * PluginFieldWidget generator test * * @param $module * @param $class_name * @param $label * @param $plugin_id * @param $field_type * * @dataProvider commandData */ public function testGeneratePluginFieldWidget($module, $class_name, $label, $plugin_id, $field_type) { $generator = new PluginFieldWidgetGenerator(); $this->getHelperSet()->get('renderer')->setSkeletonDirs($this->getSkeletonDirs()); $this->getHelperSet()->get('renderer')->setTranslator($this->getTranslatorHelper()); $generator->setHelpers($this->getHelperSet()); $generator->generate($module, $class_name, $label, $plugin_id, $field_type); $this->assertTrue(file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldWidget') . '/' . $class_name . '.php'), sprintf('%s does not exist', $class_name . '.php')); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { return; } $module = $input->getOption('module'); $class_name = $input->getOption('class'); $label = $input->getOption('label'); $plugin_id = $input->getOption('plugin-id'); $field_type = $input->getOption('field-type'); $this->generator->generate($module, $class_name, $label, $plugin_id, $field_type); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); }