/** * Build the rendering context * @author Sebastian Kurfürst <*****@*****.**> */ protected function buildRenderingContext($templateVariables) { $variableContainer = $this->objectManager->create('Tx_Fluid_Core_ViewHelper_TemplateVariableContainer', $templateVariables); $renderingContext = $this->objectManager->create('Tx_Fluid_Core_Rendering_RenderingContext'); $viewHelperVariableContainer = $this->objectManager->create('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer'); if (method_exists($renderingContext, 'setTemplateVariableContainer')) { $renderingContext->setTemplateVariableContainer($variableContainer); $renderingContext->setViewHelperVariableContainer($viewHelperVariableContainer); } else { $renderingContext->injectTemplateVariableContainer($variableContainer); $renderingContext->injectViewHelperVariableContainer($viewHelperVariableContainer); } return $renderingContext; }
/** * Gets files uploaded through field name $name * * @param Tx_Extbase_DomainObject_DomainObjectInterface $domainObject * @param string $propertyName Index name of the files in $_FILES * @param string $objectType Optional class name to use for uploaded file resources * @return Tx_Tool_Resource_FileResourceObjectStorage * @api */ public function getUploadedFiles(Tx_Extbase_DomainObject_DomainObjectInterface &$domainObject, $propertyName, $objectType = NULL) { if ($objectType === NULL) { $objectType = 'Tx_Tool_Resource_FileResource'; } $namespace = $this->domainService->getPluginNamespace($domainObject); $fileObjectStorage = $this->objectManager->create('Tx_Tool_Resource_FileResourceObjectStorage'); $postFiles = Tx_Extbase_Reflection_ObjectAccess::getProperty($_FILES[$namespace]['tmp_name'], $propertyName); if (is_array($postFiles) === FALSE) { $filename = $postFiles; $targetFilename = Tx_Extbase_Reflection_ObjectAccess::getProperty($_FILES[$namespace]['name'], $propertyName); if ($targetFilename && $targetFilename != '') { $object = $this->objectManager->create($objectType, $filename); $object->setTargetFilename($targetFilename); $fileObjectStorage->attach($object); return $fileObjectStorage; } } $numFiles = count($postFiles); for ($i = 0; $i < $numFiles; $i++) { $filename = Tx_Extbase_Reflection_ObjectAccess::getProperty($_FILES[$namespace]['tmp_name'], $propertyName . '.' . $i); $targetFilename = Tx_Extbase_Reflection_ObjectAccess::getProperty($_FILES[$namespace]['name'], $propertyName . '.' . $i); if ($targetFilename && $targetFilename != '') { if (is_file($filename)) { $object = $this->objectManager->get($objectType, $filename); $object->setTargetFilename($targetFilename); $fileObjectStorage->attach($object); } } } return $fileObjectStorage; }