public function DeleteAchievementsForm::buildForm in Opigno Learning path 8
Same name and namespace in other branches
- 3.x src/Form/DeleteAchievementsForm.php \Drupal\opigno_learning_path\Form\DeleteAchievementsForm::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 ConfirmFormBase::buildForm
File
- src/
Form/ DeleteAchievementsForm.php, line 59
Class
- DeleteAchievementsForm
- Class LearningPathAdminSettingsForm.
Namespace
Drupal\opigno_learning_path\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $group = NULL) {
$form = parent::buildForm($form, $form_state);
if (isset($group)) {
$this->group = $group;
$form['group'] = [
'#type' => 'hidden',
'#value' => $group
->id(),
];
}
$form['actions']['submit']['#name'] = 'submit';
$form['actions']['cancel']['#type'] = 'submit';
$form['actions']['cancel']['#name'] = 'cancel';
$form['actions']['cancel']['#value'] = $this
->getCancelText();
$is_ajax = $this
->getRequest()
->isXmlHttpRequest();
if ($is_ajax) {
$form['actions']['cancel']['#ajax'] = [
'callback' => [
$this,
'closeModal',
],
'event' => 'click',
];
}
return $form;
}