Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ArgumentObject.php
Go to the documentation of this file.
1 <?php
8 
13 {
14  const ARGUMENT_NAME = 'name';
15  const ARGUMENT_DEFAULT_VALUE = 'defaultValue';
16  const ARGUMENT_DATA_TYPE = 'type';
17  const ARGUMENT_DATA_ENTITY = 'entity';
18  const ARGUMENT_DATA_STRING = 'string';
19 
24  private $name;
25 
30  private $value;
31 
36  private $dataType;
37 
44  public function __construct($name, $value, $dataType)
45  {
46  $this->name = $name;
47  $this->value = $value;
48  $this->dataType = $dataType;
49  }
50 
55  public function getName()
56  {
57  return $this->name;
58  }
59 
64  public function getValue()
65  {
66  return $this->value;
67  }
68 
73  public function getDataType()
74  {
75  return $this->dataType;
76  }
77 
83  public function overrideValue($value)
84  {
85  $this->value = $value;
86  }
87 
93  public function getResolvedValue($isInnerArgument)
94  {
95  if ($this->dataType === ArgumentObject::ARGUMENT_DATA_ENTITY) {
96  return $this->value;
97  } else {
98  return $this->resolveStringArgument($isInnerArgument);
99  }
100  }
101 
114  private function resolveStringArgument($isInnerArgument)
115  {
116  if ($isInnerArgument) {
117  if (preg_match('/{{[\w.\[\]]+}}/', $this->value)) {
118  return ltrim(rtrim($this->value, "}"), "{");
119  } elseif (preg_match('/\${1,2}[\w.\[\]]+\${1,2}/', $this->value)) {
120  return $this->value;
121  }
122  return "'" . $this->value . "'";
123  } else {
124  return $this->value;
125  }
126  }
127 }
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17