You are here

public function ViewsSystemScreenshot::validateOptionsForm in Views System 8

Validate the options form.

Overrides PluginBase::validateOptionsForm

File

src/Plugin/views/field/ViewsSystemScreenshot.php, line 66
Contains \Drupal\views_system\Plugin\views\field\ViewsSystemScreenshot.

Class

ViewsSystemScreenshot
Field handler to display the thumbnail image of a theme.

Namespace

Drupal\views_system\Plugin\views\field

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue(array(
    'options',
    'image_width',
  )) != '' && !is_numeric($form_state
    ->getValue(array(
    'options',
    'image_width',
  )))) {
    $form_state
      ->setError($form['image_width'], $this
      ->t('You have to enter a numeric value for the image width.'));
  }
  if ($form_state
    ->getValue(array(
    'options',
    'image_height',
  )) != '' && !is_numeric($form_state
    ->getValue(array(
    'options',
    'image_height',
  )))) {
    $form_state
      ->setError($form['image_height'], $this
      ->t('You have to enter a numeric value for the image height.'));
  }
}