Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-layered-navigation
Observer
Edit
Tab
Front
ProductAttributeFormBuildFrontTabObserver.php
Go to the documentation of this file.
1
<?php
8
namespace
Magento\LayeredNavigation\Observer\Edit\Tab\Front
;
9
10
use
Magento\Config\Model\Config\Source
;
11
use
Magento\Framework\Module\Manager
;
12
use
Magento\Framework\Event\ObserverInterface
;
13
14
class
ProductAttributeFormBuildFrontTabObserver
implements
ObserverInterface
15
{
19
protected
$optionList
;
20
24
protected
$moduleManager
;
25
30
public
function
__construct
(
Manager
$moduleManager
, Source\
Yesno
$optionList
)
31
{
32
$this->optionList =
$optionList
;
33
$this->moduleManager =
$moduleManager
;
34
}
35
40
public
function
execute
(\
Magento
\Framework\Event\Observer
$observer
)
41
{
42
if
(!$this->moduleManager->isOutputEnabled(
'Magento_LayeredNavigation'
)) {
43
return
;
44
}
45
47
$form =
$observer
->getForm();
48
49
$fieldset = $form->getElement(
'front_fieldset'
);
50
51
$fieldset->addField(
52
'is_filterable'
,
53
'select'
,
54
[
55
'name'
=>
'is_filterable'
,
56
'label'
=>
__
(
"Use in Layered Navigation"
),
57
'title'
=>
__
(
'Can be used only with catalog input type Dropdown, Multiple Select and Price'
),
58
'note'
=>
__
(
'Can be used only with catalog input type Dropdown, Multiple Select and Price.'
),
59
'values'
=> [
60
[
'value'
=>
'0'
,
'label'
=>
__
(
'No'
)],
61
[
'value'
=>
'1'
,
'label'
=>
__
(
'Filterable (with results)'
)],
62
[
'value'
=>
'2'
,
'label'
=>
__
(
'Filterable (no results)'
)],
63
],
64
]
65
);
66
67
$fieldset->addField(
68
'is_filterable_in_search'
,
69
'select'
,
70
[
71
'name'
=>
'is_filterable_in_search'
,
72
'label'
=>
__
(
"Use in Search Results Layered Navigation"
),
73
'title'
=>
__
(
'Can be used only with catalog input type Dropdown, Multiple Select and Price'
),
74
'note'
=>
__
(
'Can be used only with catalog input type Dropdown, Multiple Select and Price.'
),
75
'values'
=> $this->optionList->toOptionArray(),
76
]
77
);
78
79
$fieldset->addField(
80
'position'
,
81
'text'
,
82
[
83
'name'
=>
'position'
,
84
'label'
=>
__
(
'Position'
),
85
'title'
=>
__
(
'Position in Layered Navigation'
),
86
'note'
=>
__
(
'Position of attribute in layered navigation block.'
),
87
'class'
=>
'validate-digits'
88
]
89
);
90
}
91
}
Magento\Config\Model\Config\Source
Magento\Framework\Event\ObserverInterface
Definition:
ObserverInterface.php:16
Magento\LayeredNavigation\Observer\Edit\Tab\Front\ProductAttributeFormBuildFrontTabObserver\__construct
__construct(Manager $moduleManager, Source\Yesno $optionList)
Definition:
ProductAttributeFormBuildFrontTabObserver.php:30
Magento\LayeredNavigation\Observer\Edit\Tab\Front\ProductAttributeFormBuildFrontTabObserver\$moduleManager
$moduleManager
Definition:
ProductAttributeFormBuildFrontTabObserver.php:24
__
__()
Definition:
__.php:13
Magento\LayeredNavigation\Observer\Edit\Tab\Front
Definition:
ProductAttributeFormBuildFrontTabObserver.php:8
Magento\Config\Model\Config\Source\Yesno
Definition:
Yesno.php:12
$observer
$observer
Definition:
second_website_with_second_currency.php:38
Magento
Magento\LayeredNavigation\Observer\Edit\Tab\Front\ProductAttributeFormBuildFrontTabObserver
Definition:
ProductAttributeFormBuildFrontTabObserver.php:14
Magento\Framework\Module\Manager
Definition:
Manager.php:20
Magento\LayeredNavigation\Observer\Edit\Tab\Front\ProductAttributeFormBuildFrontTabObserver\$optionList
$optionList
Definition:
ProductAttributeFormBuildFrontTabObserver.php:19
Magento\Framework\Event\ObserverInterface\execute
execute(Observer $observer)