-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inventory quick form #766
Inventory quick form #766
Conversation
74999ae
to
4abd727
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting an error when I try to configure the units
on the quick form with a new term that does not exist. It gets a 500 error with this log message:
InvalidArgumentException: The configuration property settings.units.entity doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of /var/www/html/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
4abd727
to
ccb0d2e
Compare
Oh good catch @paul121! This made me think of something related: maybe we should store the term label instead of the term ID in the configuration entity for inventory quick forms. This would allow the config YML to be shared between farmOS instances without any hard-coded term IDs. The term can be generated on-demand using our I've pushed a commit to that effect. Requesting your review... I also rebased onto latest |
ccb0d2e
to
f5d053f
Compare
c220df9
to
27ea902
Compare
@@ -494,7 +496,10 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta | |||
*/ | |||
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { | |||
$this->configuration['asset'] = $form_state->getValue('asset'); | |||
$this->configuration['units'] = $form_state->getValue('units'); | |||
$this->configuration['units'] = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this would end up saving an empty string if nothing was provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I suppose it should explicitly set it to NULL
if that's the new default. I'll change it to NULL
.
We do need to explicitly set it here otherwise there's no way to "unset" units in configuration.
27ea902
to
a738dfd
Compare
The entity_autocomplete widget's values are different depending on whether the selected term already exists. If it exists, the value is the term ID. If it is being created, the value is an array with an 'entity' key containing the new TermInterface object.
a738dfd
to
a09ef42
Compare
This adds an Inventory quick form. For more details on the design and discussion, refer to the following links: