<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* Redefine the display action.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
*
* @param object $stateMachine reference to state machine object
*
- * @return object
- * @access public
+ * @return \CRM_Core_QuickForm_Action_Display
+ @access public
*/
function __construct(&$stateMachine) {
parent::__construct($stateMachine);
* render the page using a custom templating
* system
*
- * @param object $page the CRM_Core_Form page
- * @param boolean $ret should we echo or return output
+ * @param object $page the CRM_Core_Form page
+ *
+ * @internal param bool $ret should we echo or return output
*
* @return void
* @access public
$template->assign('isForm', 1);
$controller = &$page->controller;
- if ($controller->getEmbedded()) {
+ // Stop here if we are in embedded mode. Exception: displaying form errors via ajax
+ if ($controller->getEmbedded() && !(!empty($form['errors']) && $controller->_QFResponseType == 'json')) {
return;
}
}
if ($controller->_QFResponseType == 'json') {
- $response = array(
- 'content' => $html,
- );
+ $response = array('content' => $html);
+ if (!empty($page->ajaxResponse)) {
+ $response += $page->ajaxResponse;
+ }
if (!empty($form['errors'])) {
$response['status'] = 'form_error';
$response['errors'] = $form['errors'];