forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeader.php
More file actions
91 lines (82 loc) · 1.94 KB
/
Header.php
File metadata and controls
91 lines (82 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Copyright 2013 Adobe
* All Rights Reserved.
*/
namespace Magento\Backend\Block\Page;
/**
* Adminhtml header block
*
* @api
* @since 100.0.2
*/
class Header extends \Magento\Backend\Block\Template
{
/**
* @var string
*/
protected $_template = 'Magento_Backend::page/header.phtml';
/**
* @var \Magento\Backend\Helper\Data
*/
protected $_backendData = null;
/**
* @var \Magento\Backend\Model\Auth\Session
*/
protected $_authSession;
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Backend\Model\Auth\Session $authSession
* @param \Magento\Backend\Helper\Data $backendData
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Backend\Model\Auth\Session $authSession,
\Magento\Backend\Helper\Data $backendData,
array $data = []
) {
$this->_backendData = $backendData;
$this->_authSession = $authSession;
parent::__construct($context, $data);
}
/**
* Return URL to homepage
*
* @return string
*/
public function getHomeLink()
{
return $this->_backendData->getHomePageUrl();
}
/**
* Return the current user
*
* @return \Magento\User\Model\User|null
*/
public function getUser()
{
return $this->_authSession->getUser();
}
/**
* Return URL to log out from admin
*
* @return string
*/
public function getLogoutLink()
{
return $this->getUrl('adminhtml/auth/logout');
}
/**
* Check if noscript notice should be displayed
*
* @return boolean
*/
public function displayNoscriptNotice()
{
return $this->_scopeConfig->getValue(
'web/browser_capabilities/javascript',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
}