You are here

public function PhpWkhtmlToPdf::validateConfigurationForm in Entity Print 8

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 PdfEngineBase::validateConfigurationForm

File

src/Plugin/EntityPrint/PdfEngine/PhpWkhtmlToPdf.php, line 70

Class

PhpWkhtmlToPdf
@PdfEngine( id = "phpwkhtmltopdf", label = @Translation("Php Wkhtmltopdf") )

Namespace

Drupal\entity_print\Plugin\EntityPrint\PdfEngine

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $binary_location = $form_state
    ->getValue('binary_location');
  if (!file_exists($binary_location)) {
    $form_state
      ->setErrorByName('binary_location', sprintf('The wkhtmltopdf binary does not exist at %s', $binary_location));
  }
}