with('tags') ->with('tags/title') ->where('title', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE') ->where('plain', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE', 'OR') ->where('status', NewsStatus::VISIBLE) ->where('publish', new \DateTime('now'), '<=') ->where('language', $response->header->l11n->language) ->where('tags/title/language', $response->header->l11n->language) ->sort('publish', OrderType::DESC) ->limit(8) ->execute(); $results = []; foreach ($news as $article) { $results[] = [ 'title' => $article->title, 'summary' => '', 'link' => '{/base}/news/article?id=' . $article->id, 'account' => '', 'createdAt' => $article->createdAt, 'image' => '', 'tags' => $article->tags, 'type' => 'list_links', 'module' => 'News', ]; } $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); $response->add($request->uri->__toString(), $results); } }