public function BrightcoveSubscriptionForm::validateForm in Brightcove Video Connect 8
Same name and namespace in other branches
- 8.2 src/Form/BrightcoveSubscriptionForm.php \Drupal\brightcove\Form\BrightcoveSubscriptionForm::validateForm()
- 3.x src/Form/BrightcoveSubscriptionForm.php \Drupal\brightcove\Form\BrightcoveSubscriptionForm::validateForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ BrightcoveSubscriptionForm.php, line 79
Class
- BrightcoveSubscriptionForm
- Builds the form for Brightcove Subscription add, edit.
Namespace
Drupal\brightcove\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// Validate endpoint, it should be unique.
if (!empty(BrightcoveSubscription::loadByEndpoint($form_state
->getValue('endpoint')))) {
$form_state
->setErrorByName('endpoint', $this
->t('A subscription with the %endpoint endpoint already exists.', [
'%endpoint' => $form_state
->getValue('endpoint'),
]));
}
}