Unverified Commit a96e6de5 authored by Mateu Aguiló Bosch's avatar Mateu Aguiló Bosch Committed by Mateu Aguiló Bosch
Browse files

Issue #3302663 by e0ipso: Allow schema validation

parent f2d0b0e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
  ],
  "require": {
    "drupal/widget_type": "^1.4",
    "e0ipso/schema-forms": "^2"
    "e0ipso/schema-forms": "^2.2"
  },
  "require-dev": {},
  "minimum-stability": "dev",
+0 −16
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ class DisplayOptionsWidget extends WidgetBase implements ContainerFactoryPluginI
      '#type' => 'fieldset',
      '#collapsible' => 'false',
      '#attributes' => ['id' => 'display-options-ajax-wrapper'],
      '#element_validate' => [[get_class($this), 'validateParamsElement']],
      '#tree' => TRUE,
    ];
    $form['type']['widget']['#ajax'] = [
@@ -156,19 +155,4 @@ class DisplayOptionsWidget extends WidgetBase implements ContainerFactoryPluginI
    );
  }

  /**
   * Form validation handler for widget elements.
   *
   * @param array $element
   *   The form element.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state.
   */
  public static function validateParamsElement(array $element, FormStateInterface $form_state) {
    $form_state->setValueForElement(
      $element,
      NestedArray::getValue($form_state->getUserInput(), $element['#parents'])
    );
  }

}