Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SearchData.php
Go to the documentation of this file.
1 <?php
7 
12 
13 abstract class SearchData extends Template implements SearchDataInterface
14 {
18  private $query;
19 
23  protected $title;
24 
28  private $searchDataProvider;
29 
33  protected $_template = 'Magento_AdvancedSearch::search_data.phtml';
34 
42  public function __construct(
43  Template\Context $context,
44  SuggestedQueriesInterface $searchDataProvider,
45  QueryFactoryInterface $queryFactory,
46  $title,
47  array $data = []
48  ) {
49  $this->searchDataProvider = $searchDataProvider;
50  $this->query = $queryFactory->get();
51  $this->title = $title;
52  parent::__construct($context, $data);
53  }
54 
58  public function getItems()
59  {
60  return $this->searchDataProvider->getItems($this->query);
61  }
62 
66  public function isShowResultsCount()
67  {
68  return $this->searchDataProvider->isResultsCountEnabled();
69  }
70 
74  public function getLink($queryText)
75  {
76  return $this->getUrl('*/*/') . '?q=' . urlencode($queryText);
77  }
78 
82  public function getTitle()
83  {
84  return __($this->title);
85  }
86 }
__construct(Template\Context $context, SuggestedQueriesInterface $searchDataProvider, QueryFactoryInterface $queryFactory, $title, array $data=[])
Definition: SearchData.php:42
__()
Definition: __.php:13