function closeblock_form_block_form_alter in Close Block 8
Implements hook_form_FORM_ID_alter().
File
- ./
closeblock.module, line 52 - Module's hooks implementations.
Code
function closeblock_form_block_form_alter(&$form, FormStateInterface $form_state, $form_id) {
/** @var \Drupal\block\Entity\Block $block */
$block = $form_state
->getFormObject()
->getEntity();
$form['third_party_settings']['#tree'] = TRUE;
$form['third_party_settings']['closeblock'] = [
'#type' => 'fieldset',
'#title' => t('Closeblock selectors'),
'#weight' => 0,
'#attributes' => [
'id' => 'closeblock_form',
],
];
$link = Link::fromTextAndUrl(t('here'), Url::fromRoute('closeblock.settings_form'))
->toString();
$form['third_party_settings']['closeblock']['closeblock_active'] = [
'#type' => 'checkbox',
'#title' => t('Use close button'),
'#default_value' => $block
->getThirdPartySetting('closeblock', 'closeblock_active'),
'#description' => t('Settings @link', [
'@link' => $link,
]),
];
}