Skip to content
Snippets Groups Projects

Feature/istwcms 6303 ebremner text align blocks

Merged Eric Bremner requested to merge feature/ISTWCMS-6303-ebremner-text-align-blocks into 1.1.x
1 file
+ 25
0
Compare changes
  • Side-by-side
  • Inline
+ 25
0
@@ -339,3 +339,28 @@ function _uw_custom_blocks_node_delete_sized_image(Node $node): void {
}
}
}
/**
* Implements hook_form_alter().
*
* Modify the configuration form for layout builder components (blocks).
*/
function uw_custom_blocks_form_alter(&$form, FormStateInterface $formState) {
// If on a layout add or edit, check for text alignment.
if (
$form['#form_id'] === 'layout_builder_add_block' ||
$form['#form_id'] === 'layout_builder_update_block'
) {
// If there is a text alignment layout builder style, check
// for the correct default value.
if (isset($form['layout_builder_style_uw_lbs_grp_text_alignment'])) {
// If there is no default value, set it to left.
if (!$form['layout_builder_style_uw_lbs_grp_text_alignment']['#default_value']) {
$form['layout_builder_style_uw_lbs_grp_text_alignment']['#default_value'] = 'uw_lbs_left';
}
}
}
}
Loading