Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * Redefine the back action. | |
14 | * | |
15 | * @package CRM | |
ca5cec67 | 16 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
17 | */ |
18 | class CRM_Core_QuickForm_Action_Done extends CRM_Core_QuickForm_Action { | |
19 | ||
20 | /** | |
d09edf64 | 21 | * Class constructor. |
6a488035 | 22 | * |
6a0b768e TO |
23 | * @param object $stateMachine |
24 | * Reference to state machine object. | |
6a488035 | 25 | * |
77b97be7 | 26 | * @return \CRM_Core_QuickForm_Action_Done |
6a488035 | 27 | */ |
00be9182 | 28 | public function __construct(&$stateMachine) { |
6a488035 TO |
29 | parent::__construct($stateMachine); |
30 | } | |
31 | ||
32 | /** | |
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 | |
37 | * | |
4bf0b605 AH |
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. | |
6a488035 | 42 | * |
0b014509 | 43 | * @return object|void |
6a488035 | 44 | */ |
00be9182 | 45 | public function perform(&$page, $actionName) { |
6a488035 TO |
46 | $page->isFormBuilt() or $page->buildForm(); |
47 | ||
48 | $pageName = $page->getAttribute('name'); | |
49 | $data = &$page->controller->container(); | |
50 | $data['values'][$pageName] = $page->exportValues(); | |
51 | $data['valid'][$pageName] = $page->validate(); | |
52 | ||
53 | // Modal form and page is invalid: don't go further | |
54 | if ($page->controller->isModal() && !$data['valid'][$pageName]) { | |
55 | return $page->handle('display'); | |
56 | } | |
57 | ||
58 | // the page is valid, process it before we jump to the next state | |
59 | $page->mainProcess(); | |
60 | ||
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(); | |
65 | } | |
96025800 | 66 | |
6a488035 | 67 | } |