public function ShariffBlock::blockValidate in Shariff Social Media Buttons 8
Overrides BlockPluginTrait::blockValidate
File
- src/
Plugin/ Block/ ShariffBlock.php, line 394
Class
- ShariffBlock
- Provides a 'shariff' block.
Namespace
Drupal\shariff\Plugin\BlockCode
public function blockValidate($form, FormStateInterface $form_state) {
$backend_url = $form_state
->getValue('shariff_backend_url');
if ($backend_url && !UrlHelper::isValid($backend_url, TRUE)) {
$this
->messenger()
->addError('Please enter a valid Backend URL.');
// TODO: Get rid of drupal_set_message() when
// https://www.drupal.org/node/2537732 is fixed.
// setErrorByName is not working for now.
$form_state
->setErrorByName('shariff_backend_url', t('Please enter a valid URL.'));
}
}