You are here

public static function FillEntityVariableFields::formValidate in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesAction/FillEntityVariableFields.php \Drupal\business_rules\Plugin\BusinessRulesAction\FillEntityVariableFields::formValidate()

Validate handler for field and value.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

File

src/Plugin/BusinessRulesAction/FillEntityVariableFields.php, line 78

Class

FillEntityVariableFields
Class FillEntityVariableFields.

Namespace

Drupal\business_rules\Plugin\BusinessRulesAction

Code

public static function formValidate(array $form, FormStateInterface $form_state) {
  if (!$form_state
    ->getValue('entity_field')) {
    $form_state
      ->setErrorByName('field', t('Select an field to add.'));
  }
  if (!$form_state
    ->getValue('field_value')) {
    $form_state
      ->setErrorByName('field_value', t('Fill a field value to add.'));
  }
}