Merge in 5.20
[civicrm-core.git] / CRM / Core / QuickForm / Action / Reload.php
CommitLineData
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 * Define the reload action. Reload the page but do not do any validation.
14 * This help with actions where we might want hooks to process some data
15 * but not validate all the fields. Was incorporated to improve the discount
16 * module integration.
17 *
18 * @package CRM
ca5cec67 19 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
20 */
21class CRM_Core_QuickForm_Action_Reload extends CRM_Core_QuickForm_Action {
22
23 /**
d09edf64 24 * Class constructor.
6a488035 25 *
6a0b768e
TO
26 * @param object $stateMachine
27 * Reference to state machine object.
6a488035 28 *
77b97be7 29 * @return \CRM_Core_QuickForm_Action_Reload
6a488035 30 */
00be9182 31 public function __construct(&$stateMachine) {
6a488035
TO
32 parent::__construct($stateMachine);
33 }
34
35 /**
36 * Processes the request.
37 *
6a0b768e
TO
38 * @param CRM_Core_Form $page
39 * CRM_Core_Form the current form-page.
40 * @param string $actionName
41 * Current action name, as one Action object can serve multiple actions.
6a488035 42 *
8eedd10a 43 * @return object|void
6a488035 44 */
00be9182 45 public function perform(&$page, $actionName) {
6a488035
TO
46 // save the form values and validation status to the session
47 $page->isFormBuilt() or $page->buildForm();
48
49 $pageName = $page->getAttribute('name');
50 $data = &$page->controller->container();
51 $data['values'][$pageName] = $page->exportValues();
52
53 return $page->handle('display');
54 }
96025800 55
6a488035 56}