2 namespace TYPO3\CMS\T3editor;
35 $GLOBALS[
'LANG']->includeLLFile(
'EXT:t3editor/Resources/Private/Language/locallang.xlf');
52 $this->
loadFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(
't3editor') .
'Resources/Private/tsref.xml');
53 $fetch = isset($parsedBody[
'fetch']) ? $parsedBody[
'fetch'] : $queryParams[
'fetch'];
61 $typeId = isset($parsedBody[
'typeId']) ? $parsedBody[
'typeId'] : $queryParams[
'typeId'];
62 $parameterName = isset($parsedBody[
'parameterName']) ? $parsedBody[
'parameterName'] : $queryParams[
'parameterName'];
63 $response = $this->getDescription($typeId, $parameterName);
64 $response->
withHeader(
'Content-Type',
'text/html; charset=utf8');
78 $this->xmlDoc = new \DOMDocument(
'1.0',
'utf-8');
79 $this->xmlDoc->load($filepath);
81 $this->xmlDoc->saveXML();
91 $types = $this->xmlDoc->getElementsByTagName(
'type');
93 foreach ($types as $type) {
94 $typeId = $type->getAttribute(
'id');
95 $typeName = $type->getAttribute(
'name');
99 $properties = $type->getElementsByTagName(
'property');
101 foreach ($properties as $property) {
103 $p[
'name'] = $property->getAttribute(
'name');
104 $p[
'type'] = $property->getAttribute(
'type');
105 $propArr[$property->getAttribute(
'name')] = $p;
107 $typeArr[$typeId] = array();
108 $typeArr[$typeId][
'properties'] = $propArr;
109 $typeArr[$typeId][
'name'] = $typeName;
110 if ($type->hasAttribute(
'extends')) {
111 $typeArr[$typeId][
'extends'] = $type->getAttribute(
'extends');
124 protected function getDescription($typeId, $parameterName =
'')
134 $type = $this->
getType($typeId);
136 if ($parameterName) {
137 $properties = $type->getElementsByTagName(
'property');
138 foreach ($properties as $propery) {
139 $propName = $propery->getAttribute(
'name');
140 if ($propName == $parameterName) {
141 $descriptions = $propery->getElementsByTagName(
'description');
142 if ($descriptions->length) {
143 $description = $descriptions->item(0)->textContent;
144 $description = htmlspecialchars($description);
145 $description = nl2br($description);
146 $response->getBody()->write($description);
163 $types = $this->xmlDoc->getElementsByTagName(
'type');
164 foreach ($types as $type) {
165 if ($type->getAttribute(
'id') == $typeId) {