You are here

public function SubscriptionBlock::blockValidate in Mailing List 8

Overrides BlockPluginTrait::blockValidate

File

src/Plugin/Block/SubscriptionBlock.php, line 176

Class

SubscriptionBlock
Mailing list subscription blocks.

Namespace

Drupal\mailing_list\Plugin\Block

Code

public function blockValidate($form, FormStateInterface $form_state) {
  if (!preg_match('/^[a-z0-9_]*$/', $form_state
    ->getValue('form_id'))) {
    $form_state
      ->setErrorByName('form_id', $this
      ->t('A unique machine-readable name containing letters, numbers, and underscores.'));
  }
}