Merge pull request #15881 from civicrm/5.20
[civicrm-core.git] / CRM / Core / QuickForm / Action / Cancel.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * Redefine the cancel action
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 */
18 class CRM_Core_QuickForm_Action_Cancel extends CRM_Core_QuickForm_Action {
19
20 /**
21 * Class constructor.
22 *
23 * @param object $stateMachine
24 * Reference to state machine object.
25 *
26 * @return \CRM_Core_QuickForm_Action_Cancel
27 */
28 public function __construct(&$stateMachine) {
29 parent::__construct($stateMachine);
30 }
31
32 /**
33 * Processes the request.
34 *
35 * @param CRM_Core_Form $page
36 * CRM_Core_Form the current form-page.
37 * @param string $actionName
38 * Current action name, as one Action object can serve multiple actions.
39 */
40 public function perform(&$page, $actionName) {
41 // conditional actions if cancelAction is defined
42 $this->_stateMachine->cancelAction();
43
44 $this->popUserContext();
45 }
46
47 }