class ProfileFormController

Form controller for the profile forms.

Hierarchy

Expanded class hierarchy of ProfileFormController

File

drupal/core/modules/user/lib/Drupal/user/ProfileFormController.php, line 15
Definition of Drupal\user\ProfileFormController.

Namespace

Drupal\user
View source
class ProfileFormController extends AccountFormController {

  /**
   * Overrides Drupal\Core\Entity\EntityFormController::actions().
   */
  protected function actions(array $form, array &$form_state) {
    $element = parent::actions($form, $form_state);
    $account = $this
      ->getEntity($form_state);
    $element['delete']['#type'] = 'submit';
    $element['delete']['#value'] = t('Cancel account');
    $element['delete']['#submit'] = array(
      'user_edit_cancel_submit',
    );
    $element['delete']['#access'] = $account->uid > 1 && ($account->uid == $GLOBALS['user']->uid && user_access('cancel account') || user_access('administer users'));
    return $element;
  }

  /**
   * Overrides Drupal\Core\Entity\EntityFormController::submit().
   */
  public function submit(array $form, array &$form_state) {

    // @todo Consider moving this into the parent method.
    // Remove unneeded values.
    form_state_values_clean($form_state);
    parent::submit($form, $form_state);
  }

  /**
   * Overrides Drupal\Core\Entity\EntityFormController::save().
   */
  public function save(array $form, array &$form_state) {
    $account = $this
      ->getEntity($form_state);
    $account
      ->save();
    $form_state['values']['uid'] = $account
      ->id();

    // Clear the page cache because pages can contain usernames and/or profile
    // information:
    cache_invalidate_tags(array(
      'content' => TRUE,
    ));
    drupal_set_message(t('The changes have been saved.'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AccountFormController::form public function Overrides Drupal\Core\Entity\EntityFormController::form(). Overrides EntityFormController::form 1
AccountFormController::validate public function Overrides Drupal\Core\Entity\EntityFormController::submit(). Overrides EntityFormController::validate
EntityFormController::$operation protected property The name of the current operation.
EntityFormController::actionsElement protected function Returns the action form element for the current entity form. 1
EntityFormController::build public function Implements Drupal\Core\Entity\EntityFormControllerInterface::build(). Overrides EntityFormControllerInterface::build
EntityFormController::buildEntity public function Implements Drupal\Core\Entity\EntityFormControllerInterface::buildEntity(). Overrides EntityFormControllerInterface::buildEntity 1
EntityFormController::delete public function Form submission handler for the 'delete' action. 5
EntityFormController::getEntity public function Implements Drupal\Core\Entity\EntityFormControllerInterface::getEntity(). Overrides EntityFormControllerInterface::getEntity 1
EntityFormController::getFormLangcode public function Implements Drupal\Core\Entity\EntityFormControllerInterface::getFormLangcode(). Overrides EntityFormControllerInterface::getFormLangcode
EntityFormController::getOperation public function Implements Drupal\Core\Entity\EntityFormControllerInterface::getOperation(). Overrides EntityFormControllerInterface::getOperation
EntityFormController::init protected function Initialize the form state and the entity before the first form build.
EntityFormController::isDefaultFormLangcode public function Implements EntityFormControllerInterface::isDefaultFormLangcode(). Overrides EntityFormControllerInterface::isDefaultFormLangcode
EntityFormController::prepareEntity protected function Prepares the entity object before the form is built first. 2
EntityFormController::setEntity public function Implements Drupal\Core\Entity\EntityFormControllerInterface::setEntity(). Overrides EntityFormControllerInterface::setEntity 1
EntityFormController::submitEntityLanguage protected function Handle possible entity language changes.
EntityFormController::__construct public function Constructs an EntityFormController object.
ProfileFormController::actions protected function Overrides Drupal\Core\Entity\EntityFormController::actions(). Overrides EntityFormController::actions
ProfileFormController::save public function Overrides Drupal\Core\Entity\EntityFormController::save(). Overrides EntityFormController::save
ProfileFormController::submit public function Overrides Drupal\Core\Entity\EntityFormController::submit(). Overrides EntityFormController::submit