public function ChangePasswordForm() { /** @var ChangePasswordForm $form */ $form = ChangePasswordForm::create($this, "ChangePasswordForm"); // The default form tries to redirect to /account/login which doesn't exist $backURL = $form->Fields()->fieldByName('BackURL'); if (!$backURL) { $backURL = new HiddenField('BackURL', 'BackURL'); $form->Fields()->push($backURL); } $backURL->setValue($this->Link('editprofile')); $this->extend('updateChangePasswordForm', $form); return $form; }
/** * Factory for generating a change password form. The form can be expanded * using an extension class and calling the updateChangePasswordForm method. * * @return Form */ public function ChangePasswordForm() { $form = ChangePasswordForm::create($this, "ChangePasswordForm"); $form->Actions()->find("name", "action_doChangePassword")->addExtraClass("btn")->addExtraClass("btn-green"); $cancel_btn = LiteralField::create("CancelLink", '<a href="' . $this->Link() . '" class="btn btn-red">' . _t("Users.CANCEL", "Cancel") . '</a>'); $form->Actions()->insertBefore($cancel_btn, "action_doChangePassword"); $this->extend("updateChangePasswordForm", $form); return $form; }
public function ChangePasswordForm() { $form = ChangePasswordForm::create($this, "ChangePasswordForm"); $this->extend('updateChangePasswordForm', $form); $this->data()->extend('updateChangePasswordForm', $form); if ($this->data()->hasMethod('updateChangePasswordForm')) { // if accessing through the model Deprecation::notice('2.0', 'Please access updateChangePasswordForm through AccountPage_Controller instead of AccountPage (this extension point is due to be removed)'); } return $form; }