6 declare(strict_types=1);
24 private $storeManager;
29 private $coreRegistry;
36 StoreManager $storeManager =
null,
40 ->get(StoreManager::class);
42 ->get(Registry::class);
54 if (
$attribute->getAttributeCode() ===
'category_name') {
55 return 'name_category_' . $this->resolveCategoryId($context);
64 private function resolveCategoryId($context): int
66 if (isset($context[
'categoryId'])) {
67 $id = $context[
'categoryId'];
69 $id = $this->coreRegistry->registry(
'current_category')
70 ? $this->coreRegistry->registry(
'current_category')->getId()
71 : $this->storeManager->getStore()->getRootCategoryId();
getFieldName(AttributeAdapter $attribute, $context=[])
__construct(StoreManager $storeManager=null, Registry $coreRegistry=null)