Skip to content
Snippets Groups Projects
Commit 42767e25 authored by damjan's avatar damjan
Browse files

[BUGFIX] Filters properties of a type by Typo3 version version

Filter by typScript group is implemented, but without select box to specify the value, normalGrouup is used as default filter value
parent ee3b2768
No related branches found
No related tags found
No related merge requests found
......@@ -48,11 +48,17 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
*
* @param string $typeUrlName - typeUrlName
* @param string $typo3Version
* @param int $typoScriptGroup
*/
public function indexAction($typeUrlName = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL) {
public function indexAction(
$typeUrlName = NULL, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL,
$typoScriptGroup = Attribute::NORMAL_GROUP
) {
if ($typeUrlName !== NULL) {
$selectedType = $this->tsrefRestService->getTypeByUrlName($typeUrlName);
$properties = $this->tsrefRestService->getPropertiesByParentId($selectedType->id);
$properties = $this->tsrefRestService->getPropertiesByParentId(
$selectedType->id, $typo3Version, $typoScriptGroup
);
$this->view->assign('properties', $properties);
$this->view->assign('selectedType', $selectedType);
$this->view->assign('typo3Groups', $this->tsrefRestService->getAllTypo3Groups());
......
......@@ -153,11 +153,22 @@ class TsrefRestService {
* Returns properties of a type (attribute which is a type) by its ID from RESOURCE_URL/ID/properties.
*
* @param int $attributeId
* @param string $typo3Version
* @param int $typo3Group
* @return mixed
*/
public function getPropertiesByParentIdJson($attributeId) {
public function getPropertiesByParentIdJson(
$attributeId, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typo3Group = Attribute::NORMAL_GROUP
) {
$curlHandle = $this->initialiseCurl('/attributes/' . $attributeId . '/properties');
$headerProperties = [
'version: ' . $typo3Version,
'typo3group: ' . $typo3Group
];
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headerProperties);
// Download the given URL, and return output
$output = curl_exec($curlHandle);
......@@ -183,10 +194,14 @@ class TsrefRestService {
* Gets all type attributes by $typo3Version and $typo3Group from RESOURCE_URL
*
* @param int $attributeId
* @param string $typo3Version
* @param int $typo3Group
* @return mixed
*/
public function getPropertiesByParentId($attributeId) { //TODO: Add filter parameters: version and typo3group
$propertiesJson = $this->getPropertiesByParentIdJson($attributeId);
public function getPropertiesByParentId(
$attributeId, $typo3Version = self::TYPO3_DEFAULT_VERSION, $typo3Group = Attribute::NORMAL_GROUP
) {
$propertiesJson = $this->getPropertiesByParentIdJson($attributeId, $typo3Version, $typo3Group);
$propertiesPhp = json_decode($propertiesJson);
return $propertiesPhp;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment