本文整理汇总了PHP中Magento\Backend\Model\Session::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::setData方法的具体用法?PHP Session::setData怎么用?PHP Session::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\Session
的用法示例。
在下文中一共展示了Session::setData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPopup
public function addPopup($text, $title = 'Debug Information')
{
if (null === $text) {
return null;
}
if (!($popups = $this->session->getData(self::GROUP_ID))) {
$popups = [];
}
if (!is_string($text)) {
$text = print_r($text, true);
}
$popups[] = ['title' => $title, 'text' => $text];
$this->session->setData(self::GROUP_ID, $popups);
return count($popups) - 1;
}
示例2: register
/**
* Register module
*
* @param $module
* @param $version
* @param string $type
*/
public function register($module, $version, $type = 'install')
{
if (null === $module || null === $version) {
return;
}
$sessionDataKey = 'is_registered_' . $module;
if ($this->session->getData($sessionDataKey)) {
return;
}
$curl = new \Magento\Framework\HTTP\Client\Curl();
try {
$curl->post(self::EXTENSION_REGISTER_URL, ['module' => $module, 'version' => $version, 'site_url' => $this->getAllUrls(), 'type' => $type]);
$this->session->setData($sessionDataKey, true);
} catch (Exception $e) {
}
}
示例3: update
/**
* Update system data for current VDE environment
*
* @param string $areaCode
* @param \Magento\Framework\App\RequestInterface $request
* @return void
*/
public function update($areaCode, \Magento\Framework\App\RequestInterface $request)
{
$mode = $request->getAlias('editorMode') ?: self::MODE_NAVIGATION;
$this->_themeContext->setEditableThemeById($request->getAlias('themeId'));
if (!$request->isAjax()) {
$this->_backendSession->setData(self::CURRENT_URL_SESSION_KEY, $request->getPathInfo());
$this->_backendSession->setData(self::CURRENT_MODE_SESSION_KEY, $mode);
}
$this->_injectUrlModel($mode);
$this->_emulateArea($mode, $areaCode);
$this->_setTheme();
$this->_disableCache();
}
示例4: getParam
/**
* Retrieve grid
*
* @param string $paramName
* @param mixed $default
* @return mixed
*/
public function getParam($paramName, $default = null)
{
$sessionParamName = $this->getId() . $paramName;
if ($this->getRequest()->has($paramName)) {
$param = $this->getRequest()->getParam($paramName);
if ($this->_saveParametersInSession) {
$this->_backendSession->setData($sessionParamName, $param);
}
return $param;
} elseif ($this->_saveParametersInSession && ($param = $this->_backendSession->getData($sessionParamName))) {
return $param;
}
return $default;
}
示例5: setItems
/**
* Set items to storage
*
* @param array $items
* @return $this
*/
public function setItems(array $items)
{
$this->_items = $items;
$this->_backendSession->setData($this->_getStorageKey(), $this->_items);
return $this;
}