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
framework
View
Page
Title.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\View\Page
;
8
9
use
Magento\Framework\App
;
10
17
class
Title
18
{
22
const
TITLE_GLUE
=
' / '
;
23
27
private
$scopeConfig;
28
32
private
$prependedValues = [];
33
37
private
$appendedValues = [];
38
42
private
$textValue;
43
47
public
function
__construct
(
48
App
\
Config
\
ScopeConfigInterface
$scopeConfig
49
) {
50
$this->scopeConfig = $scopeConfig;
51
}
52
59
public
function
set
(
$title
)
60
{
61
$this->textValue =
$title
;
62
return
$this;
63
}
64
70
public
function
get
()
71
{
72
return
join(self::TITLE_GLUE, $this->
build
());
73
}
74
80
public
function
getShort
()
81
{
82
$title
= $this->
build
();
83
return
reset(
$title
);
84
}
85
90
public
function
getShortHeading
()
91
{
92
$title
= $this->
build
(
false
);
93
return
reset(
$title
);
94
}
95
100
protected
function
build
($withConfigValues =
true
)
101
{
102
return
array_merge(
103
$this->prependedValues,
104
[$withConfigValues ? $this->
addConfigValues
($this->textValue) : $this->textValue],
105
$this->appendedValues
106
);
107
}
108
113
protected
function
addConfigValues
(
$title
)
114
{
115
$preparedTitle = $this->scopeConfig->getValue(
116
'design/head/title_prefix'
,
117
\
Magento
\Store\Model\ScopeInterface::SCOPE_STORE
118
) .
' '
.
$title
.
' '
. $this->scopeConfig->getValue(
119
'design/head/title_suffix'
,
120
\
Magento
\Store\Model\ScopeInterface::SCOPE_STORE
121
);
122
return
trim($preparedTitle);
123
}
124
130
public
function
getDefault
()
131
{
132
$defaultTitle = $this->scopeConfig->getValue(
133
'design/head/default_title'
,
134
\
Magento
\Store\Model\ScopeInterface::SCOPE_STORE
135
);
136
return
$this->
addConfigValues
($defaultTitle);
137
}
138
143
public
function
append
(
$suffix
)
144
{
145
$this->appendedValues[] =
$suffix
;
146
}
147
152
public
function
prepend
(
$prefix
)
153
{
154
array_unshift($this->prependedValues,
$prefix
);
155
}
156
162
public
function
unsetValue
()
163
{
164
$this->textValue =
null
;
165
}
166
}
$title
$title
Definition:
default.phtml:14
Magento\Framework\App
Magento\Framework\View\Page\Title\addConfigValues
addConfigValues($title)
Definition:
Title.php:113
$suffix
$suffix
Definition:
name.phtml:27
Magento\Framework\View\Page
Definition:
Builder.php:6
Magento\Framework\View\Page\Title\getShort
getShort()
Definition:
Title.php:80
Magento\Framework\View\Page\Title\append
append($suffix)
Definition:
Title.php:143
Magento\Framework\View\Page\Title
Definition:
Title.php:17
Magento\Framework\View\Page\Title\unsetValue
unsetValue()
Definition:
Title.php:162
$prefix
$prefix
Definition:
name.phtml:25
Magento\Framework\View\Page\Title\getShortHeading
getShortHeading()
Definition:
Title.php:90
Magento\Framework\View\Page\Title\TITLE_GLUE
const TITLE_GLUE
Definition:
Title.php:22
Magento
Magento\Framework\View\Page\Title\build
build($withConfigValues=true)
Definition:
Title.php:100
Magento\Framework\App\Config
Definition:
Config.php:17
Magento\Framework\View\Page\Title\prepend
prepend($prefix)
Definition:
Title.php:152
Magento\Framework\View\Page\Title\getDefault
getDefault()
Definition:
Title.php:130
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
Magento\Framework\View\Page\Title\__construct
__construct(App\Config\ScopeConfigInterface $scopeConfig)
Definition:
Title.php:47