protected function MultipleUpdatesForm::buildStateEditForm in Scheduled Publish 8.3
Builds the state entry edit form.
1 call to MultipleUpdatesForm::buildStateEditForm()
- MultipleUpdatesForm::addStates in src/
Form/ MultipleUpdatesForm.php - Adds existing state entries to the form.
File
- src/
Form/ MultipleUpdatesForm.php, line 289 - Contains \Drupal\scheduled_publish\Form\MultipleUpdatesForm.
Class
Namespace
Drupal\scheduled_publish\FormCode
protected function buildStateEditForm(&$form, $wrapper, $entry) {
$form['#element_validate'] = [
[
get_class($this),
'validateElement',
],
];
$form['moderation_state'] = [
'#type' => 'select',
'#title' => $this
->t('Moderation state change'),
'#default_value' => $entry['state'],
'#options' => $entry['state_options'],
];
$form['value'] = [
'#type' => 'datetime',
'#title' => $this
->t('Scheduled date'),
'#default_value' => new DrupalDateTime($entry['date'], ScheduledPublish::STORAGE_TIMEZONE),
'#date_increment' => 1,
'#date_timezone' => date_default_timezone_get(),
'#element_validate' => [],
];
$form['actions'] = [
'#type' => 'container',
'#weight' => 10,
];
$form['actions']['sp_edit_confirm'] = [
'#type' => 'button',
'#value' => $this
->t('Save'),
'#name' => 'sp-state-edit-confirm-' . $entry['delta'],
'#limit_validation_errors' => [
$form['#parents'],
],
'#ajax' => [
'callback' => [
get_called_class(),
'getForm',
],
'wrapper' => $wrapper,
],
'#sp_row_delta' => $entry['delta'],
];
$form['actions']['sp_edit_cancel'] = [
'#type' => 'button',
'#value' => $this
->t('Cancel'),
'#name' => 'sp-state-edit-cancel-' . $entry['delta'],
'#limit_validation_errors' => [],
'#ajax' => [
'callback' => [
get_called_class(),
'getForm',
],
'wrapper' => $wrapper,
],
'#sp_row_delta' => $entry['delta'],
];
}