Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
ISAICP-4392: Improve the user cancelation form structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
idimopoulos committed Jun 5, 2018
1 parent 5156b77 commit adb089f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions web/profiles/joinup/src/Form/UserCancelForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// Prepare a list of collections where the user is the sole owner.
$collections = $this->relationManager->getCollectionsWhereSoleOwner($this->entity);
if (!empty($collections)) {
// No access to the 'Cancel' button should be given if the user is the
// sole owner of a collection.
$form['actions']['submit']['#access'] = FALSE;
$cancel_action = ConfirmFormHelper::buildCancelLink($this, $this->getRequest());
$cancel_action['#title'] = $this->t('Go back');
$form += [
'collections' => [
'#theme' => 'item_list',
Expand All @@ -77,7 +82,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'actions' => [
'#type' => 'actions',
// @see \Drupal\Core\Entity\ContentEntityConfirmFormBase::actions()
'cancel' => ConfirmFormHelper::buildCancelLink($this, $this->getRequest()),
'cancel' => $cancel_action,
'#weight' => 10,
],
];
Expand Down Expand Up @@ -108,8 +113,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// delete the user at this point.
unset($form['description']);
}

$form['actions']['cancel']['#title'] = $this->t('Go back');
$form['user_cancel_method']['#default_value'] = 'user_cancel_delete';
$form['user_cancel_method']['#access'] = FALSE;
$form['user_cancel_confirm']['#access'] = FALSE;
Expand Down

0 comments on commit adb089f

Please sign in to comment.