Skip to content

Commit

Permalink
Merge pull request #11 from Zuluru/master
Browse files Browse the repository at this point in the history
Handle new _serialize === true functionality
  • Loading branch information
dereuromark committed Oct 29, 2015
2 parents 4ea84a9 + 8eb57e0 commit db76b73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Controller/Component/AjaxComponent.php
Expand Up @@ -75,7 +75,7 @@ public function beforeRender(Event $event) {
}

/**
* AjaxComponent::respondAsAjax()
* AjaxComponent::_respondAsAjax()
*
* @return void
*/
Expand All @@ -88,6 +88,11 @@ protected function _respondAsAjax() {
$this->Controller->set('_message', $message);
}

// If _serialize is true, *all* viewVars will be serialized; no need to add _message.
if (!empty($this->Controller->viewVars['_serialize']) && $this->Controller->viewVars['_serialize'] === true) {
return;
}

$serializeKeys = ['_message'];
if (!empty($this->Controller->viewVars['_serialize'])) {
$serializeKeys = array_merge($serializeKeys, $this->Controller->viewVars['_serialize']);
Expand Down

0 comments on commit db76b73

Please sign in to comment.