Commit Graph

7790 Commits

Author SHA1 Message Date
Michael Stenta 05a3b374bb Restrict access to user 1 so that Account Admins cannot edit it. 2023-10-06 14:15:33 -04:00
Michael Stenta 501d573b19 Add an Account Admin role with permission to administer users and assign managed roles. 2023-10-06 14:15:32 -04:00
Michael Stenta 6ac77f8106 Issue #3354935: Configurable quick forms 2023-10-06 14:13:03 -04:00
Michael Stenta 8799148196 Add CHANGELOG.md lines for Issue #3354935: Configurable quick forms 2023-10-06 14:12:36 -04:00
Michael Stenta a8f7081601 Add developer documentation for building configurable quick forms. 2023-10-06 14:11:11 -04:00
Michael Stenta de8a262685 Remove requiresEntity() method. 2023-10-06 14:11:11 -04:00
Paul Weidner 89be8e6359 Add test assertion for quick form help text 2023-10-06 14:11:10 -04:00
Michael Stenta 8ae1c6dd1f Automated tests of configurable quick forms. 2023-10-06 14:11:10 -04:00
Paul Weidner e987d9450c Configure quick form entities with correct quickId in getInstances() function 2023-10-06 14:11:10 -04:00
Paul Weidner 7506862308 Rename createInstance to getInstance for consistency with getInstances function 2023-10-06 14:11:10 -04:00
Paul Weidner 4fcc647115 Raise 404 if quick form does not exist 2023-10-06 14:11:10 -04:00
Paul Weidner f89e155f0a Load plugin definition to check requiresEntity 2023-10-06 14:11:10 -04:00
Paul Weidner 8a52fd3be6 Add cache metadata to quick form controller 2023-10-06 14:11:10 -04:00
Paul Weidner be973941aa Save default label, description and help text to quick form 2023-10-06 14:11:10 -04:00
Paul Weidner 18db434a68 Use standard entity permissions 2023-10-06 14:11:10 -04:00
Paul Weidner 3505e80124 Refactor quick form route building to a single route 2023-10-06 14:11:10 -04:00
Paul Weidner 8903ff44bc Refactor ConfigureQuickForm to use EntityForm 2023-10-06 14:11:10 -04:00
Michael Stenta fa6329f579 Generate menu task links (tabs) for quick forms and their configuration forms. 2023-10-06 14:11:10 -04:00
Michael Stenta 87fa34716d Build routes to configuration forms. 2023-10-06 14:11:10 -04:00
Michael Stenta 92c3543b87 Add a ConfigureQuickForm for building, validating, and submitting configuration forms. 2023-10-06 14:11:10 -04:00
Michael Stenta 44c443bda9 Add a permission for configuring quick forms. 2023-10-06 14:11:10 -04:00
Michael Stenta 554afce229 Add a requiresEntity boolean to quick form plugins to optionally prevent creating default instances. 2023-10-06 14:11:10 -04:00
Michael Stenta 9811f7c7f7 Exclude quick forms that are explicitly disabled. 2023-10-06 14:11:10 -04:00
Michael Stenta 898d2355f0 Introduce new getQuickId() and setQuickId() methods. Deprecate getId(). 2023-10-06 14:11:10 -04:00
Michael Stenta 11c6e5be7e Refactor QuickFormInstanceManager to return config entities. 2023-10-06 14:11:10 -04:00
Michael Stenta 6e34a09a9f Provide a ConfigurableQuickFormTrait that quick forms can use.
This uses ConfigurableTrait to add default getConfiguration(),
setConfiguration(), and defaultConfiguration() methods, and it
adds default buildConfigurationForm(), validateConfigurationForm(),
and submitConfigurationForm() methods.

The submitConfigurationForm() method does not yet save anything
automatically.
2023-10-06 14:11:10 -04:00
Michael Stenta 04e4a86b25 Provide a ConfigurableTrait with common boiler plate.
This will be replaced by a trait of the same name in Drupal core
via https://www.drupal.org/project/drupal/issues/2852463.
2023-10-06 14:11:10 -04:00
Michael Stenta 14365f6008 Provide a ConfigurableQuickFormInterface that quick forms can use to declare themselves configurable.
This extends from QuickFormInterface, as well as ConfigurableInterface
(which adds getConfiguration(), setConfiguration(), and defaultConfiguration())
and PluginFormInterface (which adds buildConfigurationForm(),
validateConfigurationForm(), and submitConfigurationForm()).
2023-10-06 14:11:10 -04:00
Michael Stenta bce6654428 Provide a configuration entity type for quick form instances. 2023-10-06 14:11:10 -04:00
Michael Stenta 78943d239d Provide a QuickFormInstanceManager service class with helper methods for instantiating quick form plugins. 2023-10-06 14:11:10 -04:00
Michael Stenta 3f559e77e9 Rename QuickFormManager to QuickFormPluginManager. 2023-10-06 14:11:10 -04:00
Paul Weidner 42fe4bc50e Update farmOS-map to v2.2.2 #724 2023-10-06 14:06:58 -04:00
Michael Stenta 109faec636 Validate quantity entities created by create_quantity #721 2023-10-06 14:02:38 -04:00
Michael Stenta 5ba9baee5d Misc quick form code and documentation improvements #703 2023-10-06 13:59:46 -04:00
Michael Stenta 6b3eb3fe52 Add CHANGELOG.md line for #703. 2023-10-06 13:59:26 -04:00
Michael Stenta 9109983cfe Fix test quick form field name. 2023-10-06 13:58:57 -04:00
Michael Stenta eb61ff23f4 Use current user's timezone in DrupalDateTime quick form examples. 2023-10-06 13:58:57 -04:00
Michael Stenta 2101da034a Fix typo in getQuickFormId() method name. 2023-10-06 13:58:57 -04:00
Michael Stenta cec5cc352a Fix camelCase of quick form plugin getLabel() method. 2023-10-06 13:58:57 -04:00
Michael Stenta 16eec9db45 Move quick form route builder method out of QuickFormManager to a new Routing/QuickFormRoutes class. 2023-10-06 13:58:57 -04:00
Michael Stenta 0393d4a76d Improve quick form development documentation.
Generalize the "Egg harvest" example to just "Harvest".
Add example farm_quick_harvest.info.yml and describe dependencies.
Add timestamp and asset reference fields.
Add more descriptions about how the quick form class methods work.
Expand on the "Quick form actions" documentation and use it in example code.
2023-10-06 13:58:57 -04:00
Michael Stenta 9c9acf5a95 Confirm that access is denied to individual quick forms without permission. 2023-10-06 13:58:57 -04:00
Michael Stenta 0a8789a7bf Move planting quick form tests into src directory. 2023-10-06 13:58:57 -04:00
Michael Stenta bc11ac5e48 Target hook_help() logic to specific quick form route IDs.
Previously this matched any route starting with farm.quick., so
if a route was created like farm.quick.myform.configure it was
also getting help text applied.
2023-10-06 13:58:57 -04:00
Michael Stenta a1daf8300c Fix abstract getId() method visibility in QuickAssetTrait, QuickLogTrait, and QuickPrepopulateTrait.
These should match QuickFormInterface, which declares getID() as a public method.
2023-10-06 13:58:57 -04:00
Michael Stenta 05c7da18b4 Extend QuickFormInterface from FormInterface.
We already implement buildForm(), validateForm(), and submitForm().
The only method this adds is getFormId(). So we will also refactor
how getFormId() works in \Drupal\farm_quick\Form\QuickForm to get
it from plugin instances instead of generating it itself.
2023-10-06 13:58:57 -04:00
Michael Stenta 5fefeb3820 QuickFormInterface does not need to extend from PluginIntrospectionInterface.
Quick forms already extend from \Drupal\Component\Plugin\PluginBase,
which implements PluginIntrospectionInterface. There is no need for
QuickFormInterface to extend from it.
2023-10-06 13:58:57 -04:00
Michael Stenta eea33c2193 farmOS Setup Menu #706 2023-10-06 13:55:23 -04:00
Michael Stenta eb103561b4 Add CHANGELOG.md line for #706 2023-10-06 13:55:15 -04:00
Paul Weidner cff262e78a Add farm_setup dependency for farm_settings 2023-10-06 13:54:59 -04:00