function scheduler_extras_form_node_form_alter in Scheduler 8
Implements hook_form_FORM_ID_alter() for node_form().
File
- tests/
modules/ scheduler_extras/ scheduler_extras.module, line 13 - Hook implementations for the Scheduler Extras test module.
Code
function scheduler_extras_form_node_form_alter(&$form, FormStateInterface $form_state) {
// This is used in SchedulerDefaultTimeTest to check that the default time is
// set correctly even when the time elememt of the datetime input is hidden.
$type = $form_state
->getFormObject()
->getEntity()->type->entity
->get('type');
if ($type == 'hidden_time') {
if (isset($form['publish_on'])) {
$form['publish_on']['widget'][0]['value']['#date_time_element'] = 'none';
}
if (isset($form['unpublish_on'])) {
$form['unpublish_on']['widget'][0]['value']['#date_time_element'] = 'none';
}
}
}