- Issue created by @rodrigoaguilera
- 🇧🇪Belgium rp7
+1 for this. My config is riddled with "empty" config like this.
People looking for a temporary workaround, this one seems to work for me:
/** * Implements hook_field_widget_third_party_settings_form(). */ function mymodule_ux_field_widget_third_party_settings_form(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, array $form, FormStateInterface $form_state) { $element = []; // Add a "nested_hide_level" checkbox to the settings form. $element['mysetting'] = [ '#type' => 'checkbox', '#title' => $this->t('My setting'), '#default_value' => $plugin->getThirdPartySetting('mymodule', 'mysetting'), '#required' => FALSE, '#element_validate' => ['_mymodule_validate_mysetting'], ]; return $element; } /** * Validates mysetting. */ function _mymodule_validate_mysetting(&$element, FormStateInterface $form_state, &$complete_form) { if (empty($element['#value'])) { $form_state->unsetValue(array_slice($element['#parents'], 0, -1)); } }