public function UpdateForm::buildForm in Workspace 8
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/ UpdateForm.php, line 129
Class
- UpdateForm
- The form to update the current workspace with its upstream.
Namespace
Drupal\workspace\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['actions']['submit']['#ajax'] = [
'callback' => [
$this,
'update',
],
'event' => 'mousedown',
'prevent' => 'click',
'progress' => [
'type' => 'throbber',
'message' => 'Updating',
],
];
if (!$this
->getUpstream()) {
unset($form['actions']['submit']);
}
unset($form['actions']['cancel']);
return $form;
}