3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00
Commit graph

66 commits

Author SHA1 Message Date
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
Michael Stenta
9109983cfe Fix test quick form field name. 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
9c9acf5a95 Confirm that access is denied to individual quick forms without permission. 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
Paul Weidner
5ca5f1a3ab Fix phpcs error that use statements should be sorted alphabetically 2023-06-13 09:53:49 -07:00
Michael Stenta
dab5415b95 Add QuickStringTrait::entityLabelsSummary() method for summarizing entity labels #675 2023-05-11 13:37:48 -04:00
Michael Stenta
8eaef1231b Abstract inline container structure into new QuickFormElementsTrait::buildInlineContainer() trait+method. 2023-04-01 14:00:38 -04:00
Michael Stenta
5ada077408 Move inline container style definition to farm_ui_theme. 2023-04-01 14:00:38 -04:00
Michael Stenta
78abcff89d Add a common CSS file for quick form styles, including an "inline" class for inline fields. 2023-04-01 14:00:38 -04:00
Michael Stenta
b807c5602f Fix quick form toolbar menu links #657 2023-03-16 14:57:29 -04:00
Michael Stenta
7a9f8f4bbe Create a QuickFormTestBase class that other quick form tests can extend from #650 2023-03-11 11:13:59 -05:00
Michael Stenta
c787d7e256 Remove default_measure configuration from quantity type definitions #612
This was originally added so that the Price quantity type could set its
default measure to "value" all the time. This was back when price
quantities were part of farmOS core. It was then moved to the
farm_ledger contrib module, and is being refactored such that it will no
longer need to make use of this default_measure configuration.
2022-12-02 14:02:24 -05:00
Michael Stenta
165547d94f Add asset/log dependencies to farm_quick_test.info.yml. 2022-11-22 16:20:40 -05:00
Michael Stenta
6c5f42b98f Use default quantity type in QuickQuantityTrait.
This removes the dependency on farm_quantity_standard.
2022-11-22 16:20:40 -05:00
Michael Stenta
5b06c00e1c Fix Constructor of class Drupal\farm_quick\Plugin\Derivative\QuickFormMenuLink has an unused parameter $base_plugin_id. 2022-09-13 10:23:48 -04:00
Michael Stenta
8b7f6fd28d Fix Call to deprecated function taxonomy_term_load_multiple_by_name() 2022-09-13 10:23:48 -04:00
Paul Weidner
7463f81f1d Implement BaseFormIdInterface and build a unique form ID from the id route parameter. 2022-06-27 11:33:25 -07:00
Paul Weidner
eef569dd1d Issue #3269543 by paul121: Automatically remove prepopulated entities from quick forms
Save prepopulated entities in a form state temporary value to reset the temp store value.
2022-03-21 19:44:38 -04:00
Michael Stenta
50fd764c44 Allow term entity to be passed to QuickQuantityTrait::createQuantity(). 2022-01-19 13:00:22 -05:00
Michael Stenta
928f95d3ba Allow full quantity entities to be passed into createLog() values. 2022-01-19 13:00:22 -05:00
Michael Stenta
5ef95da81f Add a QuickStringTrait::prioritizedString() method for joining, prioritizing, and trimming string parts. 2022-01-19 13:00:22 -05:00
Michael Stenta
278efbf27a Ensure the names/labels of assets, logs, terms, and quantities created by quick traits are less than 255 chars. 2022-01-19 13:00:22 -05:00
Michael Stenta
44c51ee957 Add a QuickStringTrait::trimString() method for trimming strings on word boundaries. 2022-01-19 13:00:22 -05:00
Michael Stenta
e2b6502f27 Make all quick trait methods protected. 2022-01-19 13:00:22 -05:00
Michael Stenta
b36f6b717b Fix Quick Form help text so that it works with new multi-route approach. 2022-01-17 07:42:00 -05:00
Paul Weidner
cb9c772962 Allow specifying a units_id to skip loading an existing term. #464 2021-12-13 12:48:45 -05:00
Michael Stenta
4a8fddd5af Dynamically add the "Quick forms" index menu item only if quick forms exist. 2021-10-27 15:22:34 -04:00
Michael Stenta
07c6ff2193 Only check entity view access in QuickFormActionBase. 2021-10-27 15:22:34 -04:00
Michael Stenta
a36bf06b4a Move QuickFormBase and QuickFormInterface to src/Plugin/QuickForm. 2021-10-27 15:22:34 -04:00
paul121
3bee8d4fb1 Provide a trait for loading prepopulated entity references. 2021-10-27 15:22:34 -04:00
paul121
560cd37168 Provide a base class for quick form action plugins. 2021-10-27 15:22:34 -04:00
paul121
ac1679841d Provide a route for each quick form. 2021-10-27 15:22:34 -04:00
paul121
b3428fc737 Only implement ContainerFactoryPluginInterface in QuickFormBase. 2021-10-27 15:22:34 -04:00
paul121
ba3011a5e6 QuickForms are provided under the Plugin/QuickForms directory. 2021-10-27 15:22:33 -04:00
Michael Stenta
93dd920391 Track which quick form created assets/logs. 2021-10-27 15:22:33 -04:00