Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ActionFlag.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Framework\App;
7 
19 {
23  protected $_request;
24 
28  protected $_flags = [];
29 
33  public function __construct(\Magento\Framework\App\RequestInterface $request)
34  {
35  $this->_request = $request;
36  }
37 
46  public function set($action, $flag, $value)
47  {
48  if ('' === $action) {
49  $action = $this->_request->getActionName();
50  }
51  $this->_flags[$this->_getControllerKey()][$action][$flag] = $value;
52  }
53 
63  public function get($action, $flag = '')
64  {
65  if ('' === $action) {
66  $action = $this->_request->getActionName();
67  }
68  if ('' === $flag) {
69  return $this->_flags[$this->_getControllerKey()] ?? [];
70  } elseif (isset($this->_flags[$this->_getControllerKey()][$action][$flag])) {
71  return $this->_flags[$this->_getControllerKey()][$action][$flag];
72  } else {
73  return false;
74  }
75  }
76 
82  protected function _getControllerKey()
83  {
84  return $this->_request->getRouteName() . '_' . $this->_request->getControllerName();
85  }
86 }
__construct(\Magento\Framework\App\RequestInterface $request)
Definition: ActionFlag.php:33
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$value
Definition: gender.phtml:16