quickFormInstanceManager = $quick_form_instance_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $container->get('quick_form.instance_manager') ); } /** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $links = []; // Load quick forms. $quick_forms = $this->quickFormInstanceManager->getInstances(); // Add links for each quick form. foreach ($quick_forms as $id => $quick_form) { $route_name = 'farm.quick.' . $id; $links[$route_name] = [ 'title' => $this->t('Quick form'), 'route_name' => $route_name, 'base_route' => $route_name, 'weight' => 0, ] + $base_plugin_definition; // If the quick form is configurable, add a link to the config form. if ($quick_form->getPlugin()->isConfigurable()) { $links["farm.quick.$id.configure"] = [ 'title' => $this->t('Configure'), 'route_name' => 'farm_quick.configure', 'route_parameters' => [ 'quick_form' => $id, ], 'base_route' => $route_name, 'weight' => 100, ] + $base_plugin_definition; } } return $links; } }