public function Math::validateConfigurationForm in Tamper 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 TamperBase::validateConfigurationForm
File
- src/
Plugin/ Tamper/ Math.php, line 91
Class
- Math
- Plugin implementation for performing basic math.
Namespace
Drupal\tamper\Plugin\TamperCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue(self::SETTING_OPERATION) === 'division' && empty($form_state
->getValue(self::SETTING_FLIP)) && $form_state
->getValue(self::SETTING_VALUE == 0)) {
$form_state
->setErrorByName(self::SETTING_VALUE, $this
->t('Cannot divide by zero.'));
}
}