public function ScheduledTransitionRescheduleForm::form in Scheduled Transitions 8
Same name and namespace in other branches
- 2.x src/Form/Entity/ScheduledTransitionRescheduleForm.php \Drupal\scheduled_transitions\Form\Entity\ScheduledTransitionRescheduleForm::form()
Gets the actual form array to be built.
Overrides ContentEntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- src/
Form/ Entity/ ScheduledTransitionRescheduleForm.php, line 69
Class
- ScheduledTransitionRescheduleForm
- Scheduled transitions reschedule form.
Namespace
Drupal\scheduled_transitions\Form\EntityCode
public function form(array $form, FormStateInterface $form_state) : array {
$scheduledTransition = $this
->getEntity();
$currentDate = new \DateTime('@' . $scheduledTransition
->getTransitionTime());
$form['current_date'] = [
'#title' => $this
->t('Current execution date'),
'#description' => $this
->t('This transition is currently scheduled to execute on this date.'),
'#type' => 'datetime',
'#default_value' => DrupalDateTime::createFromDateTime($currentDate),
'#disabled' => TRUE,
];
$form['date'] = [
'#title' => $this
->t('New execution date'),
'#description' => $this
->t('Change transition to execute on this date.'),
'#type' => 'datetime',
'#default_value' => DrupalDateTime::createFromDateTime($currentDate),
'#required' => TRUE,
];
return $form;
}