Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RequestData.php
Go to the documentation of this file.
1 <?php
7 
8 class RequestData implements \Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface
9 {
16  public function getTmpName($path)
17  {
18  return $this->_getParam('tmp_name', $path);
19  }
20 
27  public function getName($path)
28  {
29  return $this->_getParam('name', $path);
30  }
31 
39  protected function _getParam($paramName, $path)
40  {
41  $pathParts = explode('/', $path);
42  array_shift($pathParts);
43  $fieldId = array_pop($pathParts);
44  $firstGroupId = array_shift($pathParts);
45  if (!isset($_FILES['groups'][$paramName])) {
46  return null;
47  }
48  $groupData = $_FILES['groups'][$paramName];
49  if (isset($groupData[$firstGroupId])) {
50  $groupData = $groupData[$firstGroupId];
51  }
52  foreach ($pathParts as $groupId) {
53  if (isset($groupData['groups'][$groupId])) {
54  $groupData = $groupData['groups'][$groupId];
55  } else {
56  return null;
57  }
58  }
59  if (isset($groupData['fields'][$fieldId]['value'])) {
60  return $groupData['fields'][$fieldId]['value'];
61  }
62  return null;
63  }
64 }
$fieldId
Definition: element.phtml:16