TYPO3 CMS  TYPO3_6-2
DataProviderCollection.php
Go to the documentation of this file.
1 <?php
3 
23 
27  protected $dataProviders = array();
28 
32  protected $results = array();
33 
42  public function add($identifier, $classNameOrObject) {
43  if (strpos($identifier, '__') !== FALSE) {
44  throw new \UnexpectedValueException(
45  'Identifier "' . $identifier . '" must not contain "__"',
46  1381597629
47  );
48  }
49 
50  if (is_object($classNameOrObject)) {
51  $className = get_class($classNameOrObject);
52  $dataProvider = $classNameOrObject;
53  } else {
54  $className = $classNameOrObject;
55  $dataProvider = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($classNameOrObject);
56  }
57 
58  if (!$dataProvider instanceof DataProviderInterface) {
59  throw new \LogicException(
60  $className . ' must implement interface TYPO3\\CMS\\Backend\\View\\BackendLayout\\DataProviderInterface',
61  1381269811
62  );
63  }
64 
65  $this->dataProviders[$identifier] = $dataProvider;
66  }
67 
76  public function getBackendLayoutCollections(DataProviderContext $dataProviderContext) {
77  $result = array();
78 
79  foreach ($this->dataProviders as $identifier => $dataProvider) {
80  $backendLayoutCollection = $this->createBackendLayoutCollection($identifier);
81  $dataProvider->addBackendLayouts($dataProviderContext, $backendLayoutCollection);
82  $result[$identifier] = $backendLayoutCollection;
83  }
84 
85  return $result;
86  }
87 
98  public function getBackendLayout($combinedIdentifier, $pageId) {
99  $backendLayout = NULL;
100 
101  if (strpos($combinedIdentifier, '__') === FALSE) {
102  $dataProviderIdentifier = 'default';
103  $backendLayoutIdentifier = $combinedIdentifier;
104  } else {
105  list($dataProviderIdentifier, $backendLayoutIdentifier) = explode('__', $combinedIdentifier, 2);
106  }
107 
108  if (isset($this->dataProviders[$dataProviderIdentifier])) {
109  $backendLayout = $this->dataProviders[$dataProviderIdentifier]->getBackendLayout($backendLayoutIdentifier, $pageId);
110  }
111 
112  return $backendLayout;
113  }
114 
121  protected function createBackendLayoutCollection($identifier) {
122  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
123  'TYPO3\\CMS\\Backend\\View\\BackendLayout\\BackendLayoutCollection', $identifier
124  );
125  }
126 
127 }
getBackendLayoutCollections(DataProviderContext $dataProviderContext)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.