You are here

public function Wordcount::isNumeric in CKEditor Wordcount 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/CKEditorPlugin/Wordcount.php \Drupal\ckwordcount\Plugin\CKEditorPlugin\Wordcount::isNumeric()

Validation function for the settings form.

Parameters

array $element: An associative array containing the properties and children of the generic form element.

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

File

src/Plugin/CKEditorPlugin/Wordcount.php, line 167

Class

Wordcount
Defines the "wordcount" plugin.

Namespace

Drupal\ckwordcount\Plugin\CKEditorPlugin

Code

public function isNumeric(array $element, FormStateInterface $form_state) {
  if (!is_numeric($element['#value'])) {
    $form_state
      ->setError($element, 'Value must be a number.');
  }
}