5 * Contains Drupal\Console\Command\Shared\MenuTrait.
8 namespace Drupal\Console\Command\Shared;
10 use Symfony\Component\Yaml\Parser;
15 * @package Drupal\Console\Command
20 * @param string $className The form class name
24 public function menuQuestion($className)
26 if ($this->getIo()->confirm(
27 $this->trans('commands.generate.form.options.menu-link-gen'),
31 // now we need to ask them where to gen the form
34 'menu_link_gen' => true,
36 $menu_link_title = $this->getIo()->ask(
37 $menu_link_title = $this->trans('commands.generate.form.options.menu-link-title'),
40 $menuLinkFile = sprintf(
41 '%s/core/modules/system/system.links.menu.yml',
45 $parser = new Parser();
46 $menuLinkContent = $parser->parse(file_get_contents($menuLinkFile));
49 $menu_parent = $this->getIo()->choiceNoList(
50 $menu_parent = $this->trans('commands.generate.form.options.menu-parent'),
51 array_keys($menuLinkContent),
52 'system.admin_config_system'
55 $menu_link_desc = $this->getIo()->ask(
56 $menu_link_desc = $this->trans('commands.generate.form.options.menu-link-desc'),
57 $menu_link_desc = $this->trans('commands.generate.form.suggestions.description-for-menu')
59 $menu_options['menu_link_title'] = $menu_link_title;
60 $menu_options['menu_parent'] = $menu_parent;
61 $menu_options['menu_link_desc'] = $menu_link_desc;