Skip to content

Commit

Permalink
Merge pull request #1822 from bolt/bobdenotter-patch-1
Browse files Browse the repository at this point in the history
Don't break if we're trying to get content for "no ContentTypes"
  • Loading branch information
I-Valchev authored Sep 3, 2020
2 parents 0433721 + 2c5e238 commit 6ad1bde
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Storage/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Bolt\Storage;

use Bolt\Entity\Content;
use Pagerfanta\Adapter\ArrayAdapter;
use Pagerfanta\Pagerfanta;

class Query
Expand Down Expand Up @@ -73,9 +74,15 @@ public function getContentByScope(string $scopeName, string $textQuery, array $p
*
* @param string $textQuery The base part like `pages` or `pages/1`
* @param array $parameters Parameters like `printquery` and `paging`, but also `where` parameters taken from `... where { foo: bar } ...`
*
* @return Pagerfanta|Content|null
*/
public function getContentForTwig(string $textQuery, array $parameters = [])
{
if (empty($textQuery)) {
return new Pagerfanta(new ArrayAdapter([]));
}

return $this->getContentByScope('frontend', $textQuery, $parameters);
}
}

0 comments on commit 6ad1bde

Please sign in to comment.