/** * {@inheritdoc} */ protected function actions(array $form, FormStateInterface $form_state) { $element = parent::actions($form, $form_state); // The user account being edited. $account = $this->entity; // The user doing the editing. $user = $this->currentUser(); $element['delete']['#type'] = 'submit'; $element['delete']['#value'] = $this->t('Cancel account'); $element['delete']['#submit'] = array('::editCancelSubmit'); $element['delete']['#access'] = $account->id() > 1 && ($account->id() == $user->id() && $user->hasPermission('cancel account') || $user->hasPermission('administer users')); return $element; }
/** * Overrides Drupal\Core\Entity\EntityForm::actions(). */ protected function actions(array $form, FormStateInterface $form_state) { $element = parent::actions($form, $form_state); $element['submit']['#value'] = $this->t('Create new account'); return $element; }