You are here

public function HierarchicalTaxonomyMenuBlock::blockValidate in Hierarchical Taxonomy Menu 8

Overrides BlockPluginTrait::blockValidate

File

src/Plugin/Block/HierarchicalTaxonomyMenuBlock.php, line 438

Class

HierarchicalTaxonomyMenuBlock
Provides a 'HierarchicalTaxonomyMenuBlock' block.

Namespace

Drupal\hierarchical_taxonomy_menu\Plugin\Block

Code

public function blockValidate($form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue([
    'advanced',
    'show_count',
  ]) == self::SHOW_COUNT_COMMERCE_PRODUCT && $form_state
    ->getValue([
    'advanced',
    'referencing_field',
  ]) == '_none') {
    $form_state
      ->setErrorByName('advanced][referencing_field', $this
      ->t('Please select referencing field'));
  }
}