Skip to content

Commit

Permalink
Skip event handling if is Search behavior is not loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed May 25, 2016
1 parent e7f3a46 commit ce492f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Listener/ViewSearchListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function implementedEvents()
*/
public function afterPaginate(Event $event)
{
if (!$this->_table()->behaviors()->has('Search')) {
return;
}

$enabled = $this->config('enabled') ?: !$this->_request()->is('api');
if (!$enabled) {
return;
Expand Down

0 comments on commit ce492f0

Please sign in to comment.