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 * The Contact Wrapper is a wrapper class which is called by
14 * contact.module after it parses the menu path.
16 * The key elements of the wrapper are the controller and the
17 * run method as explained below.
20 * @copyright CiviCRM LLC https://civicrm.org/licensing
22 class CRM_Utils_Wrapper
{
27 * The controller which will handle the display and processing of this page.
28 * @var \CRM_Core_Controller_Simple
30 protected $_controller;
35 * The heart of the callback processing is done by this method.
36 * forms are of different type and have different operations.
38 * @param string $formName name of the form processing this action
39 * @param string $formLabel label for the above form
40 * @param array $arguments
41 * - int mode: mode of operation.
42 * - bool addSequence: should we add a unique sequence number to the end of the key
43 * - bool ignoreKey: should we not set a qfKey for this controller (for standalone forms)
47 public function run($formName, $formLabel = NULL, $arguments = NULL) {
48 if (is_array($arguments)) {
49 $mode = $arguments['mode'] ??
NULL;
50 $imageUpload = !empty($arguments['imageUpload']);
51 $addSequence = !empty($arguments['addSequence']);
52 $attachUpload = !empty($arguments['attachUpload']);
53 $ignoreKey = !empty($arguments['ignoreKey']);
58 $addSequence = $ignoreKey = $imageUpload = $attachUpload = FALSE;
61 $this->_controller
= new CRM_Core_Controller_Simple(
71 if (array_key_exists('urlToSession', $arguments)) {
72 if (is_array($arguments['urlToSession'])) {
73 foreach ($arguments['urlToSession'] as $params) {
74 $urlVar = $params['urlVar'] ??
NULL;
75 $sessionVar = $params['sessionVar'] ??
NULL;
76 $type = $params['type'] ??
NULL;
77 $default = $params['default'] ??
NULL;
78 $abort = CRM_Utils_Array
::value('abort', $params, FALSE);
81 $value = CRM_Utils_Request
::retrieve(
88 $this->_controller
->set($sessionVar, $value);
93 if (array_key_exists('setEmbedded', $arguments)) {
94 $this->_controller
->setEmbedded(TRUE);
97 $this->_controller
->process();
98 return $this->_controller
->run();