mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Build routes to configuration forms.
This commit is contained in:
parent
92c3543b87
commit
87fa34716d
1 changed files with 20 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\farm_quick\Routing;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\farm_quick\Form\ConfigureQuickForm;
|
||||
use Drupal\farm_quick\Form\QuickForm;
|
||||
use Drupal\farm_quick\QuickFormInstanceManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -51,6 +52,8 @@ class QuickFormRoutes implements ContainerInjectionInterface {
|
|||
/** @var \Drupal\farm_quick\Entity\QuickFormInstanceInterface[] $quick_forms */
|
||||
$quick_forms = $this->quickFormInstanceManager->getInstances();
|
||||
foreach ($quick_forms as $id => $quick_form) {
|
||||
|
||||
// Build a route for the quick form.
|
||||
$route = new Route(
|
||||
"/quick/$id",
|
||||
[
|
||||
|
@ -63,6 +66,23 @@ class QuickFormRoutes implements ContainerInjectionInterface {
|
|||
],
|
||||
);
|
||||
$route_collection->add("farm.quick.$id", $route);
|
||||
|
||||
// If the quick form is configurable, build a route for the configuration
|
||||
// form.
|
||||
if ($quick_form->getPlugin()->isConfigurable()) {
|
||||
$route = new Route(
|
||||
"/quick/$id/configure",
|
||||
[
|
||||
'_form' => ConfigureQuickForm::class,
|
||||
'_title_callback' => ConfigureQuickForm::class . '::getTitle',
|
||||
'id' => $id,
|
||||
],
|
||||
[
|
||||
'_custom_access' => ConfigureQuickForm::class . '::access',
|
||||
],
|
||||
);
|
||||
$route_collection->add("farm.quick.$id.configure", $route);
|
||||
}
|
||||
}
|
||||
return $route_collection;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue