You are here

public static function Price::moveInlineErrors in Price 2.0.x

Same name and namespace in other branches
  1. 8 src/Element/Price.php \Drupal\price\Element\Price::moveInlineErrors()
  2. 3.x src/Element/Price.php \Drupal\price\Element\Price::moveInlineErrors()
  3. 2.x src/Element/Price.php \Drupal\price\Element\Price::moveInlineErrors()
  4. 3.0.x src/Element/Price.php \Drupal\price\Element\Price::moveInlineErrors()

Moves inline errors from the "number" element to the main element.

This ensures that they are displayed in the right place (below both number and currency_code, instead of between them).

Only performed when the inline_form_errors module is installed.

Parameters

array $element: The form element.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

src/Element/Price.php, line 201

Class

Price
Provides a price form element.

Namespace

Drupal\price\Element

Code

public static function moveInlineErrors(array $element, FormStateInterface $form_state) {
  $error = $form_state
    ->getError($element['number']);
  if (!empty($error) && !empty($element['#price_inline_errors'])) {
    $form_state
      ->setError($element, $error);
  }
}