3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Redefine the back action.
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
18 class CRM_Core_QuickForm_Action_Done
extends CRM_Core_QuickForm_Action
{
23 * @param object $stateMachine
24 * Reference to state machine object.
26 * @return \CRM_Core_QuickForm_Action_Done
28 public function __construct(&$stateMachine) {
29 parent
::__construct($stateMachine);
33 * Processes the request.
34 * this is basically a self submit, so validate the page
35 * and if success, call post process
36 * when done processing pop to user context
38 * @param CRM_Core_Form $page
39 * The current form-page.
40 * @param string $actionName
41 * Current action name, as one Action object can serve multiple actions.
45 public function perform(&$page, $actionName) {
46 $page->isFormBuilt() or $page->buildForm();
48 $pageName = $page->getAttribute('name');
49 $data = &$page->controller
->container();
50 $data['values'][$pageName] = $page->exportValues();
51 $data['valid'][$pageName] = $page->validate();
53 // Modal form and page is invalid: don't go further
54 if ($page->controller
->isModal() && !$data['valid'][$pageName]) {
55 return $page->handle('display');
58 // the page is valid, process it before we jump to the next state
61 // ok so we are done now, pop stack and jump back to where we came from
62 // we do not reset the context because u can achieve that affect using next
63 // use Done when u want to pop back to the same context without a reset
64 $this->popUserContext();