public function TaxonomyFacetsBlock2::blockForm in Taxonomy Facets 8
Returns the configuration form elements specific to this block plugin.
Blocks that need to add form elements to the normal block configuration form should implement this method.
Parameters
array $form: The form definition array for the block configuration form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The renderable form array representing the entire configuration form.
Overrides BlockPluginTrait::blockForm
File
- src/
Plugin/ Block/ TaxonomyFacetsBlock2.php, line 45
Class
- TaxonomyFacetsBlock2
- Provides a 'Taxonomy Facets Menu' block.
Namespace
Drupal\taxonomy_facets\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$form = parent::blockForm($form, $form_state);
// Retrieve existing configuration for this block.
$config = $this
->getConfiguration();
$form['vocab_select'] = [
'#type' => 'select',
'#title' => $this
->t('Select vocabulary. This block will display filters based on the taxonomy terms from the selected vocabulary'),
'#options' => taxonomy_vocabulary_get_names(),
'#default_value' => isset($config['taxo_vocabulary_id']) ? $config['taxo_vocabulary_id'] : '',
];
return $form;
}