<?php /** * @file * Module file. */ use Drupal\Core\Form\FormStateInterface; /** * Implements hook_form_FORM_ID_alter(). * * Remove the None option from layout builder styles. */ function uw_cfg_common_form_layout_builder_configure_section_alter(array &$form, FormStateInterface $form_state, string $form_id): void { // Remove the None option from layout builder styles. unset($form['layout_builder_style']['#empty_option']); // Ensuring that the contained width is selected by default. $form['layout_builder_style']['#default_value'] = $form['layout_builder_style']['#default_value'] ?: 'uw-contained-width'; } /** * Implements hook_form_FORM_ID_alter(). */ function uw_cfg_common_form_webform_settings_confirmation_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void { // Remove undesirable Webform submission confirmation types. These appear on // admin/structure/webform/manage/*/settings/confirmation. // The 'modal' type is just a different way to display the message. Disable // for consistency. unset($form['confirmation_type']['confirmation_type']['#options']['modal']); // The 'none' type is only useful along with a custom handler which provides // the confirmation message. unset($form['confirmation_type']['confirmation_type']['#options']['none']); } /** * Implements hook_form_FORM_ID_alter(). */ function uw_cfg_common_form_webform_settings_form_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void { // Unset the source entity settings in webforms. unset($form['form_behaviors']['form_prepopulate_source_entity']); unset($form['form_behaviors']['form_prepopulate_source_entity_required']); unset($form['form_behaviors']['form_prepopulate_source_entity_type']); }