You are here

public function PhpWkhtmlToPdf::validateConfigurationForm in Entity Print 8.2

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PrintEngineBase::validateConfigurationForm

File

src/Plugin/EntityPrint/PrintEngine/PhpWkhtmlToPdf.php, line 210

Class

PhpWkhtmlToPdf
PHP wkhtmltopdf plugin.

Namespace

Drupal\entity_print\Plugin\EntityPrint\PrintEngine

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $values = OptGroup::flattenOptions($form_state
    ->getValues());
  $binary_location = isset($values['binary_location']) ? $values['binary_location'] : NULL;
  if ($binary_location && !file_exists($binary_location)) {
    $form_state
      ->setErrorByName('binary_location', sprintf('The wkhtmltopdf binary does not exist at %s', $binary_location));
  }
}