9
9
use Smile \ElasticsuiteCore \Helper \Autocomplete as ConfigurationHelper ;
10
10
use Lof \ElasticsuiteBlog \Model \ResourceModel \Post \Fulltext \CollectionFactory as PostCollectionFactory ;
11
11
use Smile \ElasticsuiteCore \Model \Autocomplete \Terms \DataProvider as TermDataProvider ;
12
+ use Ves \Blog \Helper \Data ;
12
13
13
14
/**
14
15
* Catalog product autocomplete data provider.
@@ -68,6 +69,11 @@ class DataProvider implements DataProviderInterface
68
69
*/
69
70
protected $ maxAutocompleteResults = 5 ;
70
71
72
+ /**
73
+ * @var Data
74
+ */
75
+ protected $ blogHelperData ;
76
+
71
77
/**
72
78
* Constructor.
73
79
*
@@ -77,6 +83,7 @@ class DataProvider implements DataProviderInterface
77
83
* @param postCollectionFactory $postCollectionFactory Post collection factory.
78
84
* @param ConfigurationHelper $configurationHelper Autocomplete configuration helper.
79
85
* @param StoreManagerInterface $storeManager Store manager.
86
+ * @param Data $blogHelperData Ves Blog Helper Data
80
87
* @param string $type Autocomplete provider type.
81
88
*/
82
89
public function __construct (
@@ -86,6 +93,7 @@ public function __construct(
86
93
PostCollectionFactory $ postCollectionFactory ,
87
94
ConfigurationHelper $ configurationHelper ,
88
95
StoreManagerInterface $ storeManager ,
96
+ Data $ blogHelperData ,
89
97
$ type = self ::AUTOCOMPLETE_TYPE
90
98
) {
91
99
$ this ->itemFactory = $ itemFactory ;
@@ -95,6 +103,7 @@ public function __construct(
95
103
$ this ->configurationHelper = $ configurationHelper ;
96
104
$ this ->type = $ type ;
97
105
$ this ->storeManager = $ storeManager ;
106
+ $ this ->blogHelperData = $ blogHelperData ;
98
107
}
99
108
/**
100
109
* @return string
@@ -117,7 +126,7 @@ public function getItems()
117
126
foreach ($ postCollection as $ post ) {
118
127
$ result [] = $ this ->itemFactory ->create ([
119
128
'title ' => $ post ->getTitle (),
120
- 'url ' => $ post -> getPostUrl (),
129
+ 'url ' => $ this -> blogHelperData -> getPostUrl ($ post ),
121
130
'type ' => $ this ->getType ()]);
122
131
$ i ++;
123
132
if ($ i == $ this ->maxAutocompleteResults ) {
0 commit comments