date_recur_basic_widget_test.module in Recurring Dates Field 3.0.x
Contains hooks for date_recur_basic_widget_test module.
File
tests/modules/date_recur_basic_widget_test/date_recur_basic_widget_test.module
View source
<?php
use Drupal\Core\Form\FormStateInterface;
const DATE_RECUR_BASIC_WIDGET_TEST_HIDDEN_TIMEZONE_FIELD_HOOK_FORM_ALTER = 'DATE_RECUR_BASIC_WIDGET_TEST_HIDDEN_TIMEZONE_FIELD_HOOK_FORM_ALTER';
function date_recur_basic_widget_test_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$useTimeZoneFormAlter = \Drupal::state()
->get(\DATE_RECUR_BASIC_WIDGET_TEST_HIDDEN_TIMEZONE_FIELD_HOOK_FORM_ALTER);
if (!empty($useTimeZoneFormAlter)) {
if ('dr_entity_test_dr_entity_test_form' === $form_id) {
$form['dr']['widget']['0']['timezone']['#access'] = FALSE;
}
}
}