function scheduler_form_alter in Scheduler 2.x
Same name and namespace in other branches
- 5 scheduler.module \scheduler_form_alter()
- 6 scheduler.module \scheduler_form_alter()
- 7 scheduler.module \scheduler_form_alter()
Implements hook_form_alter().
File
- ./
scheduler.module, line 51 - Scheduler publishes and unpublishes entities on dates specified by the user.
Code
function scheduler_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$scheduler_manager = \Drupal::service('scheduler.manager');
if (in_array($form_id, $scheduler_manager
->getEntityFormIds())) {
_scheduler_entity_form_alter($form, $form_state, $form_id);
}
elseif (in_array($form_id, $scheduler_manager
->getEntityTypeFormIds())) {
_scheduler_entity_type_form_alter($form, $form_state, $form_id);
}
elseif ($entityTypeId = array_search($form_id, $scheduler_manager
->getDevelGenerateFormIds())) {
// Devel Generate forms are different from the other types above. There is
// only one form id per entity type, but also no direct way to get the
// entity from the form. Hence we add the entityTypeId as a key in the array
// of returned possible form ids, and pass that on to the helper function.
_scheduler_devel_generate_form_alter($form, $form_state, $form_id, $entityTypeId);
}
}