Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Data Class Reference
Inheritance diagram for Data:
AbstractHelper Attribute

Public Member Functions

 __construct (\Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Route\Config $routeConfig, \Magento\Framework\Locale\ResolverInterface $locale, \Magento\Backend\Model\UrlInterface $backendUrl, \Magento\Backend\Model\Auth $auth, \Magento\Backend\App\Area\FrontNameResolver $frontNameResolver, \Magento\Framework\Math\Random $mathRandom)
 
 getPageHelpUrl ()
 
 setPageHelpUrl ($url=null)
 
 addPageHelpUrl ($suffix)
 
 getUrl ($route='', $params=[])
 
 getCurrentUserId ()
 
 prepareFilterString ($filterString)
 
 generateResetPasswordLinkToken ()
 
 getHomePageUrl ()
 
 getAreaFrontName ($checkHost=false)
 
- Public Member Functions inherited from AbstractHelper
 __construct (Context $context)
 
 isModuleOutputEnabled ($moduleName=null)
 

Data Fields

const XML_PATH_USE_CUSTOM_ADMIN_URL = 'admin/url/use_custom'
 

Protected Attributes

 $_pageHelpUrl
 
 $_routeConfig
 
 $_locale
 
 $_backendUrl
 
 $_auth
 
 $_frontNameResolver
 
 $mathRandom
 
- Protected Attributes inherited from AbstractHelper
 $_moduleName
 
 $_request
 
 $_moduleManager
 
 $_logger
 
 $_urlBuilder
 
 $_httpHeader
 
 $_eventManager
 
 $_remoteAddress
 
 $urlEncoder
 
 $urlDecoder
 
 $scopeConfig
 
 $_cacheConfig
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractHelper
 _getRequest ()
 
 _getModuleName ()
 
 _getUrl ($route, $params=[])
 

Detailed Description

@api

Deprecated:
100.2.0 @SuppressWarnings(PHPMD.LongVariable)
Since
100.0.2

Definition at line 16 of file Data.php.

Constructor & Destructor Documentation

◆ __construct()

Parameters
\Magento\Framework\App\Helper\Context$context
\Magento\Framework\App\Route\Config$routeConfig
\Magento\Framework\Locale\ResolverInterface$locale
\Magento\Backend\Model\UrlInterface$backendUrl
\Magento\Backend\Model\Auth$auth
\Magento\Backend\App\Area\FrontNameResolver$frontNameResolver
\Magento\Framework\Math\Random$mathRandom

Definition at line 64 of file Data.php.

72  {
73  parent::__construct($context);
74  $this->_routeConfig = $routeConfig;
75  $this->_locale = $locale;
76  $this->_backendUrl = $backendUrl;
77  $this->_auth = $auth;
78  $this->_frontNameResolver = $frontNameResolver;
79  $this->mathRandom = $mathRandom;
80  }

Member Function Documentation

◆ addPageHelpUrl()

addPageHelpUrl (   $suffix)
Parameters
string$suffix
Returns
$this

Definition at line 127 of file Data.php.

128  {
129  $this->_pageHelpUrl = $this->getPageHelpUrl() . $suffix;
130  return $this;
131  }
$suffix
Definition: name.phtml:27

◆ generateResetPasswordLinkToken()

generateResetPasswordLinkToken ( )

Generate unique token for reset password confirmation link

Returns
string

Definition at line 186 of file Data.php.

187  {
188  return $this->mathRandom->getUniqueHash();
189  }

◆ getAreaFrontName()

getAreaFrontName (   $checkHost = false)

Return Backend area front name

Parameters
bool$checkHost
Returns
bool|string

Definition at line 207 of file Data.php.

208  {
209  return $this->_frontNameResolver->getFrontName($checkHost);
210  }

◆ getCurrentUserId()

getCurrentUserId ( )
Returns
int|bool

Definition at line 146 of file Data.php.

147  {
148  if ($this->_auth->getUser()) {
149  return $this->_auth->getUser()->getId();
150  }
151  return false;
152  }

◆ getHomePageUrl()

getHomePageUrl ( )

Get backend start page URL

Returns
string

Definition at line 196 of file Data.php.

197  {
198  return $this->_backendUrl->getRouteUrl('adminhtml');
199  }

◆ getPageHelpUrl()

getPageHelpUrl ( )
Returns
string

Definition at line 85 of file Data.php.

86  {
87  if (!$this->_pageHelpUrl) {
88  $this->setPageHelpUrl();
89  }
90  return $this->_pageHelpUrl;
91  }
setPageHelpUrl($url=null)
Definition: Data.php:97

◆ getUrl()

getUrl (   $route = '',
  $params = [] 
)
Parameters
string$route
array$params
Returns
string

Definition at line 138 of file Data.php.

139  {
140  return $this->_backendUrl->getUrl($route, $params);
141  }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18

◆ prepareFilterString()

prepareFilterString (   $filterString)

Decode filter string

Parameters
string$filterString
Returns
array

Decodes URL-encoded string and trims whitespaces from the beginning and end of a string

Parameters
string$value

Definition at line 160 of file Data.php.

161  {
162  $data = [];
163  $filterString = base64_decode($filterString);
164  parse_str($filterString, $data);
165  array_walk_recursive(
166  $data,
167  // @codingStandardsIgnoreStart
173  // @codingStandardsIgnoreEnd
174  function (&$value) {
175  $value = trim(rawurldecode($value));
176  }
177  );
178  return $data;
179  }
$value
Definition: gender.phtml:16

◆ setPageHelpUrl()

setPageHelpUrl (   $url = null)
Parameters
string | null$url
Returns
$this

Definition at line 97 of file Data.php.

98  {
99  if ($url === null) {
101  $frontModule = $request->getControllerModule();
102  if (!$frontModule) {
103  $frontModule = $this->_routeConfig->getModulesByFrontName($request->getModuleName());
104  if (empty($frontModule) === false) {
105  $frontModule = $frontModule[0];
106  } else {
107  $frontModule = null;
108  }
109  }
110  $url = 'http://www.magentocommerce.com/gethelp/';
111  $url .= $this->_locale->getLocale() . '/';
112  $url .= $frontModule . '/';
113  $url .= $request->getControllerName() . '/';
114  $url .= $request->getActionName() . '/';
115 
116  $this->_pageHelpUrl = $url;
117  }
118  $this->_pageHelpUrl = $url;
119 
120  return $this;
121  }

Field Documentation

◆ $_auth

$_auth
protected

Definition at line 43 of file Data.php.

◆ $_backendUrl

$_backendUrl
protected

Definition at line 38 of file Data.php.

◆ $_frontNameResolver

$_frontNameResolver
protected

Definition at line 48 of file Data.php.

◆ $_locale

$_locale
protected

Definition at line 33 of file Data.php.

◆ $_pageHelpUrl

$_pageHelpUrl
protected

Definition at line 23 of file Data.php.

◆ $_routeConfig

$_routeConfig
protected

Definition at line 28 of file Data.php.

◆ $mathRandom

$mathRandom
protected

Definition at line 53 of file Data.php.

◆ XML_PATH_USE_CUSTOM_ADMIN_URL

const XML_PATH_USE_CUSTOM_ADMIN_URL = 'admin/url/use_custom'

Definition at line 18 of file Data.php.


The documentation for this class was generated from the following file: