function uikit_components_form_block_form_alter in UIkit Components 8.3
Same name and namespace in other branches
- 8 uikit_components.module \uikit_components_form_block_form_alter()
- 8.2 includes/alter.inc \uikit_components_form_block_form_alter()
Implements hook_form_BASE_FORM_ID_alter().
File
- includes/
alter.inc, line 129 - Modify structured content arrays.
Code
function uikit_components_form_block_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$block = $form_state
->getFormObject()
->getEntity();
$region = $block
->getRegion();
if ($region == 'navbar') {
// Add navbar alignment setting to navbar blocks.
$form['uikit_navbar_alignment'] = [
'#type' => 'select',
'#title' => t('UIkit navbar alignment'),
'#default_value' => $block
->getThirdPartySetting('uikit_components', 'uikit_navbar_alignment'),
'#options' => [
'left' => t('Left'),
'center' => t('Center'),
'right' => t('Right'),
],
'#description' => t('Select the alignment of this menu in the UIkit navbar region.'),
'#weight' => 0,
];
// Add a form entity builder.
$form['#entity_builders'][] = 'uikit_components_form_block_form_builder';
}
}