Commit a2facd2f authored by webchick's avatar webchick

Issue #2333353 by ashutoshsngh: Remove usage of form_get_errors().

parent 26564b50
......@@ -382,7 +382,7 @@ public function blockValidate($form, FormStateInterface $form_state) {}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
// Process the block's submission handling if no errors occurred only.
if (!form_get_errors($form_state)) {
if (!$form_state->getErrors()) {
$this->configuration['label'] = $form_state->getValue('label');
$this->configuration['label_display'] = $form_state->getValue('label_display');
$this->configuration['provider'] = $form_state->getValue('provider');
......
......@@ -119,7 +119,7 @@ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form
* processes a form, but does not allow you to supply values.
*
* There is no return value, but you can check to see if there are errors
* by calling form_get_errors().
* by calling $form_state->getErrors().
*
* @param \Drupal\Core\Form\FormInterface|string $form_arg
* A form object to use to build the form, or the unique string identifying
......
......@@ -613,7 +613,7 @@ function comment_preview(CommentInterface $comment, FormStateInterface $form_sta
$preview_build = array();
$entity = $comment->getCommentedEntity();
if (!form_get_errors($form_state)) {
if (!$form_state->getErrors()) {
// Attach the user and time information.
$author_name = $comment->getAuthorName();
if (!empty($author_name)) {
......
......@@ -61,7 +61,7 @@ function datetime_help($route_name, RouteMatchInterface $route_match) {
* The current state of the form.
*/
function datetime_datetime_widget_validate(&$element, FormStateInterface $form_state) {
if (!form_get_errors($form_state)) {
if (!$form_state->getErrors()) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state->getValues(), $element['#parents'], $input_exists);
if ($input_exists) {
......@@ -99,7 +99,7 @@ function datetime_datetime_widget_validate(&$element, FormStateInterface $form_s
* The current state of the form.
*/
function datetime_datelist_widget_validate(&$element, FormStateInterface $form_state) {
if (!form_get_errors($form_state)) {
if (!$form_state->getErrors()) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state->getValues(), $element['#parents'], $input_exists);
if ($input_exists) {
......
......@@ -223,7 +223,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state->setValue(array('attributes', 'alt'), '');
}
if (form_get_errors($form_state)) {
if ($form_state->getErrors()) {
unset($form['#prefix'], $form['#suffix']);
$status_messages = array('#theme' => 'status_messages');
$output = drupal_render($form);
......
......@@ -83,7 +83,7 @@ public function buildForm(array $form, FormStateInterface $form_state, FilterFor
public function submitForm(array &$form, FormStateInterface $form_state) {
$response = new AjaxResponse();
if (form_get_errors($form_state)) {
if ($form_state->getErrors()) {
unset($form['#prefix'], $form['#suffix']);
$status_messages = array('#theme' => 'status_messages');
$output = drupal_render($form);
......
......@@ -260,7 +260,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$node = $this->entity;
$preview_mode = $this->settings['preview'];
$element['submit']['#access'] = $preview_mode != DRUPAL_REQUIRED || (!form_get_errors($form_state) && isset($form_state['node_preview']));
$element['submit']['#access'] = $preview_mode != DRUPAL_REQUIRED || (!$form_state->getErrors() && isset($form_state['node_preview']));
// If saving is an option, privileged users get dedicated form submit
// buttons to adjust the publishing status while saving in one go.
......
......@@ -9,6 +9,7 @@
use Drupal\Core\Form\FormState;
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Tests the tableselect form element for expected behavior.
......@@ -223,7 +224,7 @@ private function formSubmitHelper($form, $edit) {
drupal_process_form($form_id, $form, $form_state);
$errors = form_get_errors($form_state);
$errors = $form_state->getErrors();
// Clear errors and messages.
drupal_get_messages();
......
......@@ -47,7 +47,7 @@ protected function setUp() {
* Carriage returns, tabs, spaces, and unchecked checkbox elements are not
* valid content for a required field.
*
* If the form field is found in form_get_errors() then the test pass.
* If the form field is found in $form_state->getErrors() then the test pass.
*/
function testRequiredFields() {
// Originates from http://drupal.org/node/117748
......@@ -118,7 +118,7 @@ function testRequiredFields() {
$form['#token'] = FALSE;
\Drupal::formBuilder()->prepareForm($form_id, $form, $form_state);
drupal_process_form($form_id, $form, $form_state);
$errors = form_get_errors($form_state);
$errors = $form_state->getErrors();
// Form elements of type 'radios' throw all sorts of PHP notices
// when you try to render them like this, so we ignore those for
// testing the required marker.
......
......@@ -76,7 +76,7 @@ private function submitForm($values, $valid_input) {
\Drupal::formBuilder()->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);
// Check that the form returns an error when expected, and vice versa.
$errors = form_get_errors($form_state);
$errors = $form_state->getErrors();
$valid_form = empty($errors);
$args = array(
'%values' => print_r($values, TRUE),
......
......@@ -56,7 +56,7 @@ public function testConfigForm() {
\Drupal::formBuilder()->submitForm($this->form, $form_state);
// Check that the form returns an error when expected, and vice versa.
$errors = form_get_errors($form_state);
$errors = $form_state->getErrors();
$valid_form = empty($errors);
$args = array(
'%values' => print_r($values, TRUE),
......
......@@ -189,7 +189,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
}
}
$errors = form_get_errors($form_state);
$errors = $form_state->getErrors();
$destination = drupal_get_destination();
$row_position = 0;
// Build the actual form.
......
......@@ -193,7 +193,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state['handler']->validateOptionsForm($form['options'], $form_state);
if (form_get_errors($form_state)) {
if ($form_state->getErrors()) {
$form_state['rerender'] = TRUE;
}
}
......
......@@ -99,7 +99,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state['view']->getExecutable()->displayHandlers->get($form_state['display_id'])->validateOptionsForm($form['options'], $form_state);
if (form_get_errors($form_state)) {
if ($form_state->getErrors()) {
$form_state['rerender'] = TRUE;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment