99use Smile \ElasticsuiteCore \Helper \Autocomplete as ConfigurationHelper ;
1010use Lof \ElasticsuiteBlog \Model \ResourceModel \Post \Fulltext \CollectionFactory as PostCollectionFactory ;
1111use Smile \ElasticsuiteCore \Model \Autocomplete \Terms \DataProvider as TermDataProvider ;
12+ use Ves \Blog \Helper \Data ;
1213
1314/**
1415 * Catalog product autocomplete data provider.
@@ -68,6 +69,11 @@ class DataProvider implements DataProviderInterface
6869 */
6970 protected $ maxAutocompleteResults = 5 ;
7071
72+ /**
73+ * @var Data
74+ */
75+ protected $ blogHelperData ;
76+
7177 /**
7278 * Constructor.
7379 *
@@ -77,6 +83,7 @@ class DataProvider implements DataProviderInterface
7783 * @param postCollectionFactory $postCollectionFactory Post collection factory.
7884 * @param ConfigurationHelper $configurationHelper Autocomplete configuration helper.
7985 * @param StoreManagerInterface $storeManager Store manager.
86+ * @param Data $blogHelperData Ves Blog Helper Data
8087 * @param string $type Autocomplete provider type.
8188 */
8289 public function __construct (
@@ -86,6 +93,7 @@ public function __construct(
8693 PostCollectionFactory $ postCollectionFactory ,
8794 ConfigurationHelper $ configurationHelper ,
8895 StoreManagerInterface $ storeManager ,
96+ Data $ blogHelperData ,
8997 $ type = self ::AUTOCOMPLETE_TYPE
9098 ) {
9199 $ this ->itemFactory = $ itemFactory ;
@@ -95,6 +103,7 @@ public function __construct(
95103 $ this ->configurationHelper = $ configurationHelper ;
96104 $ this ->type = $ type ;
97105 $ this ->storeManager = $ storeManager ;
106+ $ this ->blogHelperData = $ blogHelperData ;
98107 }
99108 /**
100109 * @return string
@@ -117,7 +126,7 @@ public function getItems()
117126 foreach ($ postCollection as $ post ) {
118127 $ result [] = $ this ->itemFactory ->create ([
119128 'title ' => $ post ->getTitle (),
120- 'url ' => $ post -> getPostUrl (),
129+ 'url ' => $ this -> blogHelperData -> getPostUrl ($ post ),
121130 'type ' => $ this ->getType ()]);
122131 $ i ++;
123132 if ($ i == $ this ->maxAutocompleteResults ) {
0 commit comments