public function SmartDateOverrideDeleteAjaxForm::buildForm in Smart Date 3.2.x
Same name and namespace in other branches
- 8.2 modules/smart_date_recur/src/Form/SmartDateOverrideDeleteAjaxForm.php \Drupal\smart_date_recur\Form\SmartDateOverrideDeleteAjaxForm::buildForm()
- 3.x modules/smart_date_recur/src/Form/SmartDateOverrideDeleteAjaxForm.php \Drupal\smart_date_recur\Form\SmartDateOverrideDeleteAjaxForm::buildForm()
- 3.0.x modules/smart_date_recur/src/Form/SmartDateOverrideDeleteAjaxForm.php \Drupal\smart_date_recur\Form\SmartDateOverrideDeleteAjaxForm::buildForm()
- 3.1.x modules/smart_date_recur/src/Form/SmartDateOverrideDeleteAjaxForm.php \Drupal\smart_date_recur\Form\SmartDateOverrideDeleteAjaxForm::buildForm()
- 3.3.x modules/smart_date_recur/src/Form/SmartDateOverrideDeleteAjaxForm.php \Drupal\smart_date_recur\Form\SmartDateOverrideDeleteAjaxForm::buildForm()
- 3.4.x modules/smart_date_recur/src/Form/SmartDateOverrideDeleteAjaxForm.php \Drupal\smart_date_recur\Form\SmartDateOverrideDeleteAjaxForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- modules/
smart_date_recur/ src/ Form/ SmartDateOverrideDeleteAjaxForm.php, line 25
Class
- SmartDateOverrideDeleteAjaxForm
- Provides AJAX handling of override deletion.
Namespace
Drupal\smart_date_recur\FormCode
public function buildForm(array $form, FormStateInterface $form_state, SmartDateOverride $entity = NULL) {
$cancelurl = new Url('smart_date_recur.instances', [
'rrule' => (int) $entity->rrule->value,
'modal' => TRUE,
]);
$submiturl = new Url('smart_date_recur.instance.revert.ajax', [
'entity' => $entity
->id(),
'confirm' => 1,
]);
$form['#prefix'] = '<div id="manage-instances">';
$form['#suffix'] = '</div>';
$form['message'] = [
'#markup' => '<p>' . $this
->t('Revert this Instance?') . '</p>',
];
$form['delete'] = [
'#type' => 'link',
'#title' => $this
->t('Revert'),
'#attributes' => [
'class' => [
'button',
'button--primary',
'use-ajax',
],
],
'#url' => $submiturl,
'#cache' => [
'contexts' => [
'url.query_args:destination',
],
],
];
$form['cancel'] = [
'#type' => 'link',
'#title' => $this
->t('Cancel'),
'#attributes' => [
'class' => [
'button',
'use-ajax',
],
],
'#url' => $cancelurl,
'#cache' => [
'contexts' => [
'url.query_args:destination',
],
],
];
return $form;
}