1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace app\modules\shop\controllers; |
4
|
|
|
|
5
|
|
|
use app\components\Controller; |
6
|
|
|
use app\extensions\DefaultTheme\components\BaseWidget; |
7
|
|
|
use app\extensions\DefaultTheme\models\ThemeActiveWidgets; |
8
|
|
|
use app\extensions\DefaultTheme\models\ThemeWidgets; |
9
|
|
|
use app\extensions\DefaultTheme\widgets\FilterSets\Widget; |
10
|
|
|
use app\models\BaseObject; |
11
|
|
|
use app\models\PropertyStaticValues; |
12
|
|
|
use app\models\Search; |
13
|
|
|
use app\modules\core\helpers\ContentBlockHelper; |
14
|
|
|
use app\modules\core\helpers\EventTriggeringHelper; |
15
|
|
|
use app\modules\core\models\ContentBlock; |
16
|
|
|
use app\modules\shop\events\ProductPageShowed; |
17
|
|
|
use app\modules\shop\exceptions\EmptyFilterHttpException; |
18
|
|
|
use app\modules\shop\models\Category; |
19
|
|
|
use app\modules\shop\models\Product; |
20
|
|
|
use app\traits\DynamicContentTrait; |
21
|
|
|
use devgroup\TagDependencyHelper\ActiveRecordHelper; |
22
|
|
|
use Yii; |
23
|
|
|
use yii\caching\TagDependency; |
24
|
|
|
use yii\data\Pagination; |
25
|
|
|
use yii\helpers\ArrayHelper; |
26
|
|
|
use yii\helpers\Json; |
27
|
|
|
use yii\helpers\Url; |
28
|
|
|
use yii\web\ForbiddenHttpException; |
29
|
|
|
use yii\web\NotFoundHttpException; |
30
|
|
|
use yii\web\Response; |
31
|
|
|
use yii\web\ServerErrorHttpException; |
32
|
|
|
use app\modules\seo\behaviors\SetCanonicalBehavior; |
33
|
|
|
|
34
|
|
|
class ProductController extends Controller |
35
|
|
|
{ |
36
|
|
|
use DynamicContentTrait; |
37
|
|
|
|
38
|
|
|
public function behaviors() |
39
|
|
|
{ |
40
|
|
|
return [ |
41
|
|
|
[ |
42
|
|
|
'class' => SetCanonicalBehavior::className() |
|
|
|
|
43
|
|
|
] |
44
|
|
|
]; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Products listing by category with filtration support. |
49
|
|
|
* |
50
|
|
|
* @return string |
51
|
|
|
* @throws \Exception |
52
|
|
|
* @throws NotFoundHttpException |
53
|
|
|
* @throws ServerErrorHttpException |
54
|
|
|
*/ |
55
|
|
|
public function actionList() |
56
|
|
|
{ |
57
|
|
|
|
58
|
|
|
$request = Yii::$app->request; |
59
|
|
|
|
60
|
|
|
if (null === $request->get('category_group_id')) { |
61
|
|
|
throw new NotFoundHttpException; |
62
|
|
|
} |
63
|
|
|
$product = Yii::$container->get(Product::class); |
64
|
|
|
if (null === $object = BaseObject::getForClass(get_class($product))) { |
65
|
|
|
throw new ServerErrorHttpException('Object not found.'); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
$category_group_id = intval($request->get('category_group_id', 0)); |
69
|
|
|
|
70
|
|
|
$title_append = $request->get('title_append', ''); |
71
|
|
|
if (!empty($title_append)) { |
72
|
|
|
$title_append = is_array($title_append) ? implode(' ', $title_append) : $title_append; |
73
|
|
|
unset($_GET['title_append']); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
$title_prepend = $request->get("title_prepend", ""); |
77
|
|
|
if (!empty($title_prepend)) { |
78
|
|
|
$title_prepend = is_array($title_prepend) ? implode(" ", $title_prepend) : $title_prepend; |
79
|
|
|
unset($_GET["title_prepend"]); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
$values_by_property_id = $request->get('properties', []); |
83
|
|
|
if (!is_array($values_by_property_id)) { |
84
|
|
|
$values_by_property_id = [$values_by_property_id]; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
if (Yii::$app->request->isPost && isset($_POST['properties'])) { |
88
|
|
|
if (is_array($_POST['properties'])) { |
89
|
|
|
foreach ($_POST['properties'] as $key => $value) { |
90
|
|
|
if (isset($values_by_property_id[$key])) { |
91
|
|
|
$values_by_property_id[$key] = array_unique( |
92
|
|
|
ArrayHelper::merge( |
93
|
|
|
$values_by_property_id[$key], |
94
|
|
|
$value |
95
|
|
|
) |
96
|
|
|
); |
97
|
|
|
} else { |
98
|
|
|
$values_by_property_id[$key] = array_unique($value); |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
$selected_category_ids = $request->get('categories', []); |
105
|
|
|
if (!is_array($selected_category_ids)) { |
106
|
|
|
$selected_category_ids = [$selected_category_ids]; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
if (null !== $selected_category_id = $request->get('last_category_id')) { |
110
|
|
|
$selected_category_id = intval($selected_category_id); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
$result = $product::filteredProducts( |
114
|
|
|
$category_group_id, |
115
|
|
|
$values_by_property_id, |
116
|
|
|
$selected_category_id, |
117
|
|
|
false, |
118
|
|
|
null, |
119
|
|
|
true, |
120
|
|
|
false |
121
|
|
|
); |
122
|
|
|
/** @var Pagination $pages */ |
123
|
|
|
$pages = $result['pages']; |
124
|
|
|
if (Yii::$app->response->is_prefiltered_page) { |
125
|
|
|
$pages->route = '/' . Yii::$app->request->pathInfo; |
126
|
|
|
$pages->params = [ |
127
|
|
|
|
128
|
|
|
]; |
129
|
|
|
} |
130
|
|
|
$allSorts = $result['allSorts']; |
131
|
|
|
$products = $result['products']; |
132
|
|
|
|
133
|
|
|
// throw 404 if we are at filtered page without any products |
134
|
|
|
if (!Yii::$app->request->isAjax && !empty($values_by_property_id) && empty($products)) { |
135
|
|
|
throw new EmptyFilterHttpException(); |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
if (null !== $selected_category = $selected_category_id) { |
139
|
|
|
if ($selected_category_id > 0) { |
140
|
|
|
if (null !== $selected_category = Category::findById($selected_category_id, null)) { |
141
|
|
View Code Duplication |
if (!empty($selected_category->meta_description)) { |
142
|
|
|
$this->view->registerMetaTag( |
|
|
|
|
143
|
|
|
[ |
144
|
|
|
'name' => 'description', |
145
|
|
|
'content' => ContentBlockHelper::compileContentString( |
146
|
|
|
$selected_category->meta_description, |
147
|
|
|
get_class($product) . ":{$selected_category->id}:meta_description", |
148
|
|
|
new TagDependency( |
149
|
|
|
[ |
150
|
|
|
'tags' => [ |
151
|
|
|
ActiveRecordHelper::getCommonTag(ContentBlock::className()), |
|
|
|
|
152
|
|
|
ActiveRecordHelper::getCommonTag(Category::className()) |
|
|
|
|
153
|
|
|
] |
154
|
|
|
] |
155
|
|
|
) |
156
|
|
|
) |
157
|
|
|
], |
158
|
|
|
'meta_description' |
159
|
|
|
); |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
$this->view->title = $selected_category->title; |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
} |
166
|
|
|
if (is_null($selected_category) || !$selected_category->active) { |
167
|
|
|
throw new NotFoundHttpException; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
if (!empty($title_append)) { |
171
|
|
|
$this->view->title .= " " . $title_append; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
if (!empty($title_prepend)) { |
175
|
|
|
$this->view->title = "{$title_prepend} {$this->view->title}"; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
$this->view->blocks['h1'] = $selected_category->h1; |
179
|
|
|
$this->view->blocks['announce'] = $selected_category->announce; |
180
|
|
|
$this->view->blocks['content'] = $selected_category->content; |
181
|
|
|
|
182
|
|
|
/* |
183
|
|
|
не все запросы с фильтрами отдают данные в get параметрах. Фильтр в боковом меню использует пост данные для передачи информации о фильтрах |
184
|
|
|
*/ |
185
|
|
|
$requestParams = $request->get(); |
186
|
|
|
$postParams = $request->post(); |
187
|
|
|
if(!empty($postParams['properties'])){ |
188
|
|
|
$requestParams['properties'] = $postParams['properties']; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
$this->loadDynamicContent($object->id, 'shop/product/list', $requestParams); |
192
|
|
|
|
193
|
|
|
$params = [ |
194
|
|
|
'model' => $selected_category, |
195
|
|
|
'selected_category' => $selected_category, |
196
|
|
|
'selected_category_id' => $selected_category_id, |
197
|
|
|
'selected_category_ids' => $selected_category_ids, |
198
|
|
|
'values_by_property_id' => $values_by_property_id, |
199
|
|
|
'products' => $products, |
200
|
|
|
'object' => $object, |
201
|
|
|
'category_group_id' => $category_group_id, |
202
|
|
|
'pages' => $pages, |
203
|
|
|
'title_append' => $title_append, |
204
|
|
|
'selections' => $request->get(), |
205
|
|
|
'breadcrumbs' => $this->buildBreadcrumbsArray($selected_category, null, $values_by_property_id), |
206
|
|
|
'allSorts' => $allSorts, |
207
|
|
|
]; |
208
|
|
|
$viewFile = $this->computeViewFile($selected_category, 'list'); |
209
|
|
|
|
210
|
|
|
if (Yii::$app->request->isAjax) { |
211
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
212
|
|
|
|
213
|
|
|
$content = $this->renderAjax( |
214
|
|
|
$viewFile, |
215
|
|
|
$params |
216
|
|
|
); |
217
|
|
|
$filters = ''; |
218
|
|
|
$activeWidgets = ThemeActiveWidgets::getActiveWidgets(); |
219
|
|
|
foreach ($activeWidgets as $activeWidget) { |
220
|
|
|
if ($activeWidget->widget->widget == Widget::className()) { |
|
|
|
|
221
|
|
|
/** @var ThemeWidgets $widgetModel */ |
222
|
|
|
$widgetModel = $activeWidget->widget; |
223
|
|
|
/** @var BaseWidget $widgetClassName */ |
224
|
|
|
$widgetClassName = $widgetModel->widget; |
225
|
|
|
$widgetConfiguration = Json::decode($widgetModel->configuration_json, true); |
226
|
|
|
if (!is_array($widgetConfiguration)) { |
227
|
|
|
$widgetConfiguration = []; |
228
|
|
|
} |
229
|
|
|
$activeWidgetConfiguration = Json::decode($activeWidget->configuration_json, true); |
230
|
|
|
if (!is_array($activeWidgetConfiguration)) { |
231
|
|
|
$activeWidgetConfiguration = []; |
232
|
|
|
} |
233
|
|
|
$config = ArrayHelper::merge($widgetConfiguration, $activeWidgetConfiguration); |
234
|
|
|
$config['themeWidgetModel'] = $widgetModel; |
235
|
|
|
$config['partRow'] = $activeWidget->part; |
236
|
|
|
$config['activeWidget'] = $activeWidget; |
237
|
|
|
$filters = $widgetClassName::widget($config); |
238
|
|
|
} |
239
|
|
|
} |
240
|
|
|
return [ |
|
|
|
|
241
|
|
|
'content' => $content, |
242
|
|
|
'filters' => $filters, |
243
|
|
|
'title' => $this->view->title, |
244
|
|
|
'h1' => $this->view->blocks['h1'], |
245
|
|
|
'url' => Url::to( |
246
|
|
|
[ |
247
|
|
|
'/shop/product/list', |
248
|
|
|
'last_category_id' => $selected_category_id, |
249
|
|
|
'category_group_id' => $category_group_id, |
250
|
|
|
'properties' => $values_by_property_id |
251
|
|
|
] |
252
|
|
|
), |
253
|
|
|
]; |
254
|
|
|
} else { |
255
|
|
|
return $this->render( |
256
|
|
|
$viewFile, |
257
|
|
|
$params |
258
|
|
|
); |
259
|
|
|
} |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* Product page view |
264
|
|
|
* |
265
|
|
|
* @param null $model_id |
266
|
|
|
* @return string |
267
|
|
|
* @throws NotFoundHttpException |
268
|
|
|
* @throws ServerErrorHttpException |
269
|
|
|
*/ |
270
|
|
|
public function actionShow($model_id = null) |
271
|
|
|
{ |
272
|
|
|
$product = Yii::$container->get(Product::class); |
273
|
|
|
if (null === $object = BaseObject::getForClass(get_class($product))) { |
274
|
|
|
throw new ServerErrorHttpException('Object not found.'); |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
$productModel = $product::findById($model_id); |
278
|
|
|
|
279
|
|
|
$request = Yii::$app->request; |
280
|
|
|
|
281
|
|
|
$values_by_property_id = $request->get('properties', []); |
282
|
|
|
if (!is_array($values_by_property_id)) { |
283
|
|
|
$values_by_property_id = [$values_by_property_id]; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
$selected_category_id = $request->get('last_category_id'); |
287
|
|
|
|
288
|
|
|
$selected_category_ids = $request->get('categories', []); |
289
|
|
|
if (!is_array($selected_category_ids)) { |
290
|
|
|
$selected_category_ids = [$selected_category_ids]; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
$category_group_id = intval($request->get('category_group_id', 0)); |
294
|
|
|
|
295
|
|
|
// trigger that we are to show product to user! |
296
|
|
|
// wow! such product! very events! |
297
|
|
|
$specialEvent = new ProductPageShowed([ |
298
|
|
|
'product_id' => $productModel->id, |
299
|
|
|
]); |
300
|
|
|
EventTriggeringHelper::triggerSpecialEvent($specialEvent); |
301
|
|
|
|
302
|
|
View Code Duplication |
if (!empty($productModel->meta_description)) { |
303
|
|
|
$this->view->registerMetaTag( |
|
|
|
|
304
|
|
|
[ |
305
|
|
|
'name' => 'description', |
306
|
|
|
'content' => ContentBlockHelper::compileContentString( |
307
|
|
|
$productModel->meta_description, |
308
|
|
|
get_class($product) . ":{$productModel->id}:meta_description", |
309
|
|
|
new TagDependency( |
310
|
|
|
[ |
311
|
|
|
'tags' => [ |
312
|
|
|
ActiveRecordHelper::getCommonTag(ContentBlock::className()), |
|
|
|
|
313
|
|
|
ActiveRecordHelper::getCommonTag(get_class($product)) |
314
|
|
|
] |
315
|
|
|
] |
316
|
|
|
) |
317
|
|
|
) |
318
|
|
|
], |
319
|
|
|
'meta_description' |
320
|
|
|
); |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
$selected_category = ($selected_category_id > 0) ? Category::findById($selected_category_id) : null; |
324
|
|
|
|
325
|
|
|
$this->view->title = $productModel->title; |
326
|
|
|
$this->view->blocks['h1'] = $productModel->h1; |
327
|
|
|
$this->view->blocks['announce'] = $productModel->announce; |
328
|
|
|
$this->view->blocks['content'] = $productModel->content; |
329
|
|
|
$this->view->blocks['title'] = $productModel->title; |
330
|
|
|
|
331
|
|
|
|
332
|
|
|
return $this->render( |
333
|
|
|
$this->computeViewFile($productModel, 'show'), |
334
|
|
|
[ |
335
|
|
|
'model' => $productModel, |
336
|
|
|
'category_group_id' => $category_group_id, |
337
|
|
|
'values_by_property_id' => $values_by_property_id, |
338
|
|
|
'selected_category_id' => $selected_category_id, |
339
|
|
|
'selected_category' => $selected_category, |
340
|
|
|
'selected_category_ids' => $selected_category_ids, |
341
|
|
|
'object' => $object, |
342
|
|
|
'breadcrumbs' => $this->buildBreadcrumbsArray($selected_category, $productModel) |
|
|
|
|
343
|
|
|
] |
344
|
|
|
); |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Search handler |
349
|
|
|
* @return array |
350
|
|
|
* @throws ForbiddenHttpException |
351
|
|
|
*/ |
352
|
|
|
public function actionSearch() |
353
|
|
|
{ |
354
|
|
|
$headers = Yii::$app->response->getHeaders(); |
355
|
|
|
$headers->set('X-Robots-Tag', 'none'); |
356
|
|
|
$headers->set('X-Frame-Options', 'SAMEORIGIN'); |
357
|
|
|
$headers->set('X-Content-Type-Options', 'nosniff'); |
358
|
|
|
if (!Yii::$app->request->isAjax) { |
359
|
|
|
throw new ForbiddenHttpException(); |
360
|
|
|
} |
361
|
|
|
$model = new Search(); |
362
|
|
|
$model->load(Yii::$app->request->get()); |
363
|
|
|
$cacheKey = 'ProductSearchIds: ' . $model->q; |
364
|
|
|
$ids = Yii::$app->cache->get($cacheKey); |
365
|
|
|
$product = Yii::$container->get(Product::class); |
366
|
|
|
if ($ids === false) { |
367
|
|
|
$ids = ArrayHelper::merge( |
368
|
|
|
$model->searchProductsByDescription(), |
369
|
|
|
$model->searchProductsByProperty() |
370
|
|
|
); |
371
|
|
|
Yii::$app->cache->set( |
372
|
|
|
$cacheKey, |
373
|
|
|
$ids, |
374
|
|
|
86400, |
375
|
|
|
new TagDependency( |
376
|
|
|
[ |
377
|
|
|
'tags' => ActiveRecordHelper::getCommonTag(get_class($product)), |
378
|
|
|
] |
379
|
|
|
) |
380
|
|
|
); |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** @var \app\modules\shop\ShopModule $module */ |
384
|
|
|
$module = Yii::$app->modules['shop']; |
385
|
|
|
|
386
|
|
|
$pages = new Pagination( |
387
|
|
|
[ |
388
|
|
|
'defaultPageSize' => $module->searchResultsLimit, |
389
|
|
|
'forcePageParam' => false, |
390
|
|
|
'totalCount' => count($ids), |
391
|
|
|
] |
392
|
|
|
); |
393
|
|
|
$cacheKey .= ' : ' . $pages->offset; |
394
|
|
|
$products = Yii::$app->cache->get($cacheKey); |
395
|
|
View Code Duplication |
if ($products === false) { |
396
|
|
|
$products = $product::find()->where( |
397
|
|
|
[ |
398
|
|
|
'in', |
399
|
|
|
'`id`', |
400
|
|
|
array_slice( |
401
|
|
|
$ids, |
402
|
|
|
$pages->offset, |
403
|
|
|
$pages->limit |
404
|
|
|
) |
405
|
|
|
] |
406
|
|
|
)->addOrderBy('sort_order')->with('images')->all(); |
407
|
|
|
Yii::$app->cache->set( |
408
|
|
|
$cacheKey, |
409
|
|
|
$products, |
410
|
|
|
86400, |
411
|
|
|
new TagDependency( |
412
|
|
|
[ |
413
|
|
|
'tags' => ActiveRecordHelper::getCommonTag(get_class($product)), |
414
|
|
|
] |
415
|
|
|
) |
416
|
|
|
); |
417
|
|
|
} |
418
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
419
|
|
|
return [ |
420
|
|
|
'view' => $this->renderAjax( |
421
|
|
|
'search', |
422
|
|
|
[ |
423
|
|
|
'model' => $model, |
424
|
|
|
'pages' => $pages, |
425
|
|
|
'products' => $products, |
426
|
|
|
] |
427
|
|
|
), |
428
|
|
|
'totalCount' => count($ids), |
429
|
|
|
]; |
430
|
|
|
|
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
434
|
|
|
* This function build array for widget "Breadcrumbs" |
435
|
|
|
* @param Category $selCat - model of current category |
436
|
|
|
* @param Product|null $product - model of product, if current page is a page of product |
437
|
|
|
* @param array $properties - array of properties and static values |
438
|
|
|
* Return an array for widget or empty array |
439
|
|
|
*/ |
440
|
|
|
private function buildBreadcrumbsArray($selCat, $product = null, $properties = []) |
441
|
|
|
{ |
442
|
|
|
if ($selCat === null) { |
443
|
|
|
return []; |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
// init |
447
|
|
|
$breadcrumbs = []; |
448
|
|
|
if ($product !== null && !empty($selCat) && empty($product->breadcrumbs_label) === false) { |
449
|
|
|
$crumbs[$product->breadcrumbs_label] = Url::to( |
|
|
|
|
450
|
|
|
[ |
451
|
|
|
'@product', |
452
|
|
|
'model' => $product, |
453
|
|
|
'category_group_id' => $selCat->category_group_id, |
454
|
|
|
] |
455
|
|
|
); |
456
|
|
|
} |
457
|
|
|
// get basic data |
458
|
|
|
$parent = empty($selCat) === false ? $selCat : null; |
459
|
|
|
while ($parent !== null) { |
460
|
|
|
$crumbs[$parent->breadcrumbs_label] = [ |
|
|
|
|
461
|
|
|
'@category', |
462
|
|
|
'last_category_id' => $parent->id, |
463
|
|
|
'category_group_id' => $parent->category_group_id, |
464
|
|
|
]; |
465
|
|
|
$parent = $parent->parent; |
466
|
|
|
} |
467
|
|
|
|
468
|
|
|
// build array for widget |
469
|
|
|
$crumbs = array_reverse($crumbs, true); |
470
|
|
|
foreach ($crumbs as $label => $url) { |
471
|
|
|
$breadcrumbs[] = [ |
472
|
|
|
'label' => $label, |
473
|
|
|
'url' => $url |
474
|
|
|
]; |
475
|
|
|
} |
476
|
|
|
if (is_null($product) && $this->module->showFiltersInBreadcrumbs && !empty($properties)) { |
477
|
|
|
$route = [ |
478
|
|
|
'@category', |
479
|
|
|
'last_category_id' => $selCat->id, |
480
|
|
|
'category_group_id' => $selCat->category_group_id, |
481
|
|
|
]; |
482
|
|
|
$params = []; |
483
|
|
|
foreach ($properties as $propertyId => $propertyStaticValues) { |
484
|
|
|
$localParams = $params; |
485
|
|
|
foreach ((array)$propertyStaticValues as $propertyStaticValue) { |
486
|
|
|
$psv = PropertyStaticValues::findById($propertyStaticValue); |
487
|
|
|
if (is_null($psv)) { |
488
|
|
|
continue; |
489
|
|
|
} |
490
|
|
|
$localParams[$propertyId][] = $propertyStaticValue; |
491
|
|
|
$breadcrumbs[] = [ |
492
|
|
|
'label' => $psv['name'], |
493
|
|
|
'url' => array_merge($route, ['properties' => $localParams]), |
494
|
|
|
]; |
495
|
|
|
} |
496
|
|
|
$params[$propertyId] = $propertyStaticValues; |
497
|
|
|
} |
498
|
|
|
} |
499
|
|
|
unset($breadcrumbs[count($breadcrumbs) - 1]['url']); // last item is not a link |
500
|
|
|
|
501
|
|
|
if (isset(Yii::$app->response->blocks['breadcrumbs_label'])) { |
502
|
|
|
// last item label rewrited through prefiltered page or something similar |
503
|
|
|
$breadcrumbs[count($breadcrumbs) - 1]['label'] = Yii::$app->response->blocks['breadcrumbs_label']; |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
return $breadcrumbs; |
507
|
|
|
} |
508
|
|
|
} |
509
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.