상속: extends FluidTYPO3\Flux\Form\AbstractFormContainer, implements FluidTYPO3\Flux\Form\FieldContainerInterface
예제 #1
0
 /**
  * @param Form $form
  * @return string
  */
 public function render(Form $form)
 {
     $record = $form->getOption(Form::OPTION_RECORD);
     $table = $form->getOption(Form::OPTION_RECORD_TABLE);
     $field = $form->getOption(Form::OPTION_RECORD_FIELD);
     $this->ensureBackendDocumentExists();
     $formHandler = $this->getFormEngine();
     return $formHandler->printNeededJSFunctions_top() . $formHandler->getSoloField($table, $record, $field) . $formHandler->printNeededJSFunctions();
 }
예제 #2
0
 /**
  * @return array
  */
 public function getPostProcessBackendLayoutTestValues()
 {
     $form = Form::create(array('id' => 'formId'));
     /** @var Provider|\PHPUnit_Framework_MockObject_MockObject $standardProvider */
     $standardProvider = $this->getMock('FluidTYPO3\\Flux\\Provider\\Provider', array('getControllerActionFromRecord', 'getForm'));
     $standardProvider->setTemplatePaths(array());
     $standardProvider->expects($this->any())->method('getForm')->willReturn($form);
     $actionLessProvider = clone $standardProvider;
     $exceptionProvider = clone $standardProvider;
     $emptyGridProvider = clone $standardProvider;
     $gridProvider = clone $standardProvider;
     $actionLessProvider->expects($this->any())->method('getControllerActionFromRecord')->willReturn(null);
     $exceptionProvider->expects($this->any())->method('getControllerActionFromRecord')->willThrowException(new \RuntimeException());
     /** @var Grid $grid */
     $grid = Grid::create();
     $grid->setParent($form);
     $emptyGridProvider->setGrid($grid);
     $emptyGridProvider->expects($this->any())->method('getControllerActionFromRecord')->willReturn('default');
     /** @var Grid $grid */
     $grid = Grid::create(array());
     $grid->setParent($form);
     $grid->createContainer('Row', 'row')->createContainer('Column', 'column')->setColSpan(3)->setRowSpan(3)->setColumnPosition(2);
     $gridProvider->setGrid($grid);
     $gridProvider->expects($this->any())->method('getControllerActionFromRecord')->willReturn('default');
     $gridArray = array('__config' => array('backend_layout.' => array('colCount' => 3, 'rowCount' => 1, 'rows.' => array('1.' => array('columns.' => array('1.' => array('name' => 'LLL:EXT:flux/Resources/Private/Language/locallang.xlf:flux.formId.columns.column', 'colPos' => 2, 'colspan' => 3, 'rowspan' => 3)))))), '__colPosList' => array(2), '__items' => array(array('LLL:EXT:flux/Resources/Private/Language/locallang.xlf:flux.formId.columns.column', 2, null)));
     return array(array($standardProvider, null, 'message', 0, array()), array($standardProvider, array(), 'message', 1, array()), array($actionLessProvider, array(), 'message', 1, array()), array($emptyGridProvider, array(), 'message', 1, array()), array($exceptionProvider, array(), 'debug', 1, array()), array($gridProvider, array(), 'message', 0, $gridArray));
 }
예제 #3
0
 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return void
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer();
     $templateVariableContainer = $renderingContext->getTemplateVariableContainer();
     $extensionName = static::getExtensionNameFromRenderingContextOrArguments($renderingContext, $arguments);
     $form = Form::create();
     $container = $form->last();
     // configure Form instance
     $form->setId($arguments['id']);
     $form->setName($arguments['id']);
     $form->setLabel($arguments['label']);
     $form->setDescription($arguments['description']);
     $form->setEnabled($arguments['enabled']);
     $form->setCompact($arguments['compact']);
     $form->setExtensionName($extensionName);
     $form->setLocalLanguageFileRelativePath($arguments['localLanguageFileRelativePath']);
     $form->setVariables((array) $arguments['variables']);
     $form->setOptions((array) $arguments['options']);
     if (FALSE === $form->hasOption(Form::OPTION_ICON)) {
         $form->setOption(Form::OPTION_ICON, $arguments['icon']);
     }
     if (FALSE === $form->hasOption(Form::OPTION_GROUP)) {
         $form->setOption(Form::OPTION_GROUP, $arguments['wizardTab']);
     }
     // rendering child nodes with Form's last sheet as active container
     $viewHelperVariableContainer->addOrUpdate(static::SCOPE, static::SCOPE_VARIABLE_FORM, $form);
     $viewHelperVariableContainer->addOrUpdate(static::SCOPE, static::SCOPE_VARIABLE_EXTENSIONNAME, $extensionName);
     $templateVariableContainer->add(static::SCOPE_VARIABLE_FORM, $form);
     static::setContainerInRenderingContext($renderingContext, $container);
     $renderChildrenClosure();
     $viewHelperVariableContainer->remove(static::SCOPE, static::SCOPE_VARIABLE_EXTENSIONNAME);
     $viewHelperVariableContainer->remove(static::SCOPE, static::SCOPE_VARIABLE_CONTAINER);
     $templateVariableContainer->remove(static::SCOPE_VARIABLE_CONTAINER);
 }
예제 #4
0
 /**
  * Render method
  * @return void
  */
 public function render()
 {
     $extensionName = $this->getExtensionName();
     $form = Form::create();
     $container = $form->last();
     // configure Form instance
     $form->setId($this->arguments['id']);
     $form->setName($this->arguments['id']);
     $form->setLabel($this->arguments['label']);
     $form->setDescription($this->arguments['description']);
     $form->setEnabled($this->arguments['enabled']);
     $form->setCompact($this->arguments['compact']);
     $form->setExtensionName($extensionName);
     $form->setLocalLanguageFileRelativePath($this->arguments['localLanguageFileRelativePath']);
     $form->setVariables((array) $this->arguments['variables']);
     $form->setOptions((array) $this->arguments['options']);
     if (FALSE === $form->hasOption(Form::OPTION_ICON)) {
         $form->setOption(Form::OPTION_ICON, $this->arguments['icon']);
     }
     if (FALSE === $form->hasOption(Form::OPTION_GROUP)) {
         $form->setOption(Form::OPTION_GROUP, $this->arguments['wizardTab']);
     }
     // rendering child nodes with Form's last sheet as active container
     $this->viewHelperVariableContainer->addOrUpdate(self::SCOPE, self::SCOPE_VARIABLE_FORM, $form);
     $this->viewHelperVariableContainer->addOrUpdate(self::SCOPE, self::SCOPE_VARIABLE_EXTENSIONNAME, $extensionName);
     $this->templateVariableContainer->add(self::SCOPE_VARIABLE_FORM, $form);
     $this->setContainer($container);
     $this->renderChildren();
     $this->viewHelperVariableContainer->remove(self::SCOPE, self::SCOPE_VARIABLE_EXTENSIONNAME);
     $this->viewHelperVariableContainer->remove(self::SCOPE, self::SCOPE_VARIABLE_CONTAINER);
     $this->templateVariableContainer->remove(self::SCOPE_VARIABLE_CONTAINER);
 }
예제 #5
0
 /**
  * @test
  */
 public function canSetDefaultValueFromCsvfAlreadyCorrectStrings()
 {
     $instance = Form::create(array())->createField('File', 'file');
     $defaultValue = 'testfile1.jpg|testfile1.jpg,testfile2.jpg|testfile2.jpg';
     $instance->setDefault($defaultValue);
     $this->assertSame($defaultValue, $instance->getDefault());
 }
 /**
  * @test
  * @dataProvider getValuesAndTransformations
  * @param mixed $value
  * @param string $transformation
  * @param mixed $expected
  */
 public function testTransformation($value, $transformation, $expected)
 {
     $instance = $this->createInstance();
     $form = Form::create();
     $form->createField('Input', 'field')->setTransform($transformation);
     $transformed = $instance->transformAccordingToConfiguration(array('field' => $value), $form);
     $this->assertTrue($transformed !== $expected, 'Transformation type ' . $transformation . ' failed; values are still identical');
 }
 /**
  * @dataProvider getFormTestValues
  * @param array $record
  */
 public function testGetForm(array $record)
 {
     $instance = $this->getMock('FluidTYPO3\\FluidcontentCore\\Provider\\CoreContentProvider', array('resolveFormClassName', 'setDefaultValuesInFieldsWithInheritedValues'));
     $form = Form::create();
     $instance->setForm($form);
     $result = $instance->getForm($record);
     $this->assertInstanceOf('FluidTYPO3\\Flux\\Form', $result);
 }
예제 #8
0
 /**
  * @test
  */
 public function modifyModifiesFields()
 {
     $form = Form::create();
     $sheet = $form->createContainer('Sheet', 'testsheet');
     $field = $sheet->createField('Input', 'testfield', 'Testfield');
     $sheet->modify(array('fields' => array('testfield' => array('label' => 'Test'))));
     $fields = $sheet->getFields();
     $this->assertEquals('Test', reset($fields)->getLabel());
 }
 /**
  * @test
  */
 public function triggersDomainModelAnalysisWhenFormsAreRegistered()
 {
     $class = 'FluidTYPO3\\Flux\\Domain\\Model\\Dummy';
     $form = Form::create();
     Core::registerAutoFormForModelObjectClassName($class);
     $object = GeneralUtility::getUserObj('FluidTYPO3\\Flux\\Backend\\TableConfigurationPostProcessor');
     $object->processData();
     Core::registerFormForModelObjectClassName($class, $form);
     $object->processData();
 }
 /**
  * @return void
  */
 public function testDetectAndRegisterAllFluidBackendModules()
 {
     $form = Form::create();
     $instance = $this->getMock('FluidTYPO3\\Fluidbackend\\Service\\ConfigurationService', array('getBackendModuleTemplatePaths', 'getFormFromTemplateFile', 'registerModuleBasedOnFluxForm'));
     $paths = new TemplatePaths('FluidTYPO3.Fluidbackend');
     $instance->expects($this->once())->method('getBackendModuleTemplatePaths')->willReturn(array('FluidTYPO3.Fluidbackend' => $paths->toArray()));
     $instance->expects($this->atLeastOnce())->method('registerModuleBasedOnFluxForm');
     $instance->expects($this->atLeastOnce())->method('getFormFromTemplateFile')->willReturn($form);
     $instance->detectAndRegisterAllFluidBackendModules();
 }
예제 #11
0
 /**
  * @test
  * @dataProvider getValuesAndTransformations
  * @param mixed $value
  * @param string $transformation
  * @param mixed $expected
  */
 public function testTransformation($value, $transformation, $expected)
 {
     $instance = $this->getMock('FluidTYPO3\\Flux\\Transformation\\FormDataTransformer', array('loadObjectsFromRepository'));
     $instance->expects($this->any())->method('loadObjectsFromRepository')->willReturn(array());
     $instance->injectObjectManager($this->objectManager);
     $form = Form::create();
     $form->createField('Input', 'field')->setTransform($transformation);
     $transformed = $instance->transformAccordingToConfiguration(array('field' => $value), $form);
     $this->assertTrue($transformed !== $expected, 'Transformation type ' . $transformation . ' failed; values are still identical');
 }
예제 #12
0
 /**
  * @test
  */
 public function testRender()
 {
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = array();
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array();
     $form = Form::create();
     $nodeFactory = $this->getMock(NodeFactory::class, array('create'));
     $nodeFactory->expects($this->once())->method('create')->willReturn($this->getMock(NodeInterface::class));
     $instance = $this->getMock($this->createInstanceClassName(), array('getNodeFactory'));
     $instance->expects($this->once())->method('getNodeFactory')->willReturn($nodeFactory);
     $instance->render($form);
 }
 public function testRenderWizardTabItem()
 {
     $form = Form::create();
     $form->setLabel('bazlabel');
     $form->setDescription('foobar');
     $service = $this->getMock('FluidTYPO3\\Fluidcontent\\Service\\ConfigurationService', array(), array(), '', FALSE);
     $result = $this->callInaccessibleMethod($service, 'buildWizardTabItem', 'tabid', 'id', $form, '');
     $this->assertContains('tabid.elements.id', $result);
     $this->assertContains('title = bazlabel', $result);
     $this->assertContains('description = foobar', $result);
 }
예제 #14
0
 /**
  * @test
  */
 public function testRender()
 {
     $form = Form::create();
     $engine = $this->getMock('TYPO3\\CMS\\Backend\\Form\\FormEngine', array('printNeededJSFunctions_top', 'getSoloField', 'printNeededJSFunctions'), array(), '', FALSE);
     $engine->expects($this->once())->method('printNeededJSFunctions_top')->willReturn('1');
     $engine->expects($this->once())->method('getSoloField')->willReturn('2');
     $engine->expects($this->once())->method('printNeededJSFunctions')->willReturn('3');
     $instance = $this->getMock($this->createInstanceClassName(), array('getFormEngine'));
     $instance->expects($this->once())->method('getFormEngine')->willReturn($engine);
     $result = $instance->render($form);
     $this->assertEquals('123', $result);
 }
 /**
  * @return array
  */
 public function getAddSubIconTestValues()
 {
     $formWithoutIcon = Form::create();
     $formWithIcon = Form::create(array('options' => array('icon' => 'icon')));
     $providerWithoutForm = $this->getMock('FluidTYPO3\\Flux\\Provider\\Provider', array('getForm'));
     $providerWithoutForm->expects($this->any())->method('getForm')->willReturn(NULL);
     $providerWithFormWithoutIcon = $this->getMock('FluidTYPO3\\Flux\\Provider\\Provider', array('getForm'));
     $providerWithFormWithoutIcon->expects($this->any())->method('getForm')->willReturn($formWithoutIcon);
     $providerWithFormWithIcon = $this->getMock('FluidTYPO3\\Flux\\Provider\\Provider', array('getForm'));
     $providerWithFormWithIcon->expects($this->any())->method('getForm')->willReturn($formWithIcon);
     return array(array(array('pages', 1, array()), NULL, NULL), array(array('tt_content', 1, array()), NULL, NULL), array(array('tt_content', 1, array()), $providerWithoutForm, NULL), array(array('tt_content', 1, array('field' => 'test')), $providerWithoutForm, NULL), array(array('tt_content', 1, array('field' => 'test')), $providerWithFormWithoutIcon, NULL), array(array('tt_content', 1, array('field' => 'test')), $providerWithFormWithIcon, 'icon'));
 }
예제 #16
0
 /**
  * @return Form
  */
 protected function getForm()
 {
     if (TRUE === $this->viewHelperVariableContainer->exists(self::SCOPE, self::SCOPE_VARIABLE_FORM)) {
         $form = $this->viewHelperVariableContainer->get(self::SCOPE, self::SCOPE_VARIABLE_FORM);
     } elseif (TRUE === $this->templateVariableContainer->exists(self::SCOPE_VARIABLE_FORM)) {
         $form = $this->templateVariableContainer->get(self::SCOPE_VARIABLE_FORM);
     } else {
         $form = Form::create();
         $this->viewHelperVariableContainer->add(self::SCOPE, self::SCOPE_VARIABLE_FORM, $form);
     }
     return $form;
 }
 /**
  * @test
  */
 public function triggersDomainModelAnalysisWhenFormsAreRegistered()
 {
     $class = 'FluidTYPO3\\Flux\\Tests\\Fixtures\\Classes\\Domain\\Model\\Dummy';
     $form = Form::create();
     $form->setExtensionName('FluidTYPO3.Flux');
     Core::registerAutoFormForModelObjectClassName($class);
     $object = GeneralUtility::getUserObj('FluidTYPO3\\Flux\\Backend\\TableConfigurationPostProcessor');
     $object->processData();
     Core::registerFormForModelObjectClassName($class, $form);
     $result = $object->processData();
     $this->assertEmpty($result);
 }
예제 #18
0
 /**
  * @test
  */
 public function triggersContentManipulatorOnDatabaseOperationNew()
 {
     $row = Records::$contentRecordWithoutParentAndWithoutChildren;
     $form = Form::create();
     $provider = $this->getMock('FluidTYPO3\\Flux\\Provider\\ContentProvider', array('loadRecordFromDatabase', 'getForm'));
     $provider->expects($this->once())->method('loadRecordFromDatabase')->willReturn(array('foo' => 'bar'));
     $provider->expects($this->once())->method('getForm')->willReturn($form);
     /** @var DataHandler $tceMain */
     $tceMain = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
     $result = $provider->postProcessDatabaseOperation('new', $row['uid'], $row, $tceMain);
     $this->assertEmpty($result);
 }
 /**
  * @test
  */
 public function testGetCurrentOutlet()
 {
     $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array('exec_SELECTquery', 'sql_fetch_assoc', 'exec_INSERTquery'));
     $form = Form::create();
     $request = new Request();
     $provider = $this->getMock('FluidTYPO3\\Flux\\Provider\\Provider', array('getForm'));
     $provider->expects($this->once())->method('getForm')->willReturn($form);
     $instance = $this->getMockForAbstractClass('FluidTYPO3\\Fluidbackend\\Controller\\AbstractBackendController');
     $this->inject($instance, 'provider', $provider);
     $this->inject($instance, 'request', $request);
     $result = $this->callInaccessibleMethod($instance, 'getCurrentOutlet');
     $this->assertInstanceOf('FluidTYPO3\\Flux\\Outlet\\OutletInterface', $result);
 }
예제 #20
0
 /**
  * @param Form $form
  * @return string
  */
 public function render(Form $form)
 {
     $record = $form->getOption(Form::OPTION_RECORD);
     $table = $form->getOption(Form::OPTION_RECORD_TABLE);
     $field = $form->getOption(Form::OPTION_RECORD_FIELD);
     $node = $this->getNodeFactory()->create(array('type' => 'flex', 'renderType' => 'flex', 'flexFormDataStructureArray' => $form->build(), 'tableName' => $table, 'fieldName' => $field, 'databaseRow' => $record, 'inlineStructure' => array(), 'parameterArray' => array('itemFormElName' => sprintf('data[%s][%d][%s]', $table, (int) $record['uid'], $field), 'itemFormElValue' => GeneralUtility::xml2array($record[$field]), 'fieldChangeFunc' => array(), 'fieldConf' => array('config' => array('ds' => $form->build())))));
     $output = $node->render();
     return $output['html'];
 }
예제 #21
0
 /**
  * @return void
  */
 public function testRenderFieldCreatesExpectedOptions()
 {
     $configurationService = $this->getMock('FluidTYPO3\\Fluidcontent\\Service\\ConfigurationService', array('getContentElementFormInstances'));
     $forms = array('myextension' => array(Form::create(array('id' => 'test1', 'label' => 'Test1', 'options' => array('contentElementId' => 'test1'))), Form::create(array('id' => 'test2', 'label' => 'Test2', 'options' => array('contentElementId' => 'test2')))));
     $parameters = array('itemFormElName' => 'foobar', 'itemFormElValue' => 'test2');
     $parent = 'unused';
     $configurationService->expects($this->once())->method('getContentElementFormInstances')->willReturn($forms);
     $instance = $this->getMock('FluidTYPO3\\Fluidcontent\\Backend\\ContentSelector', array('getConfigurationService'));
     $instance->expects($this->once())->method('getConfigurationService')->willReturn($configurationService);
     $rendered = $instance->renderField($parameters, $parent);
     $this->assertContains('<optgroup label="myextension">', $rendered);
     $this->assertContains('<option', $rendered);
     $this->assertContains('value="test1"', $rendered);
     $this->assertContains('value="test2"', $rendered);
 }
예제 #22
0
 /**
  * Returns the icon for a template
  * - checks and returns if manually set as option or
  * - checks and returns Icon if it exists by convention in
  *   EXT:$extensionKey/Resources/Public/Icons/$controllerName/$templateName.(png|gif)
  *
  * @param Form $form
  * @return string|NULL
  */
 public static function getIconForTemplate(Form $form)
 {
     if (TRUE === $form->hasOption(Form::OPTION_ICON)) {
         return $form->getOption(Form::OPTION_ICON);
     }
     if (TRUE === $form->hasOption(Form::OPTION_TEMPLATEFILE)) {
         $extensionKey = ExtensionNamingUtility::getExtensionKey($form->getExtensionName());
         $fullTemplatePathAndName = $form->getOption(Form::OPTION_TEMPLATEFILE);
         $templatePathParts = explode('/', $fullTemplatePathAndName);
         $templateName = pathinfo(array_pop($templatePathParts), PATHINFO_FILENAME);
         $controllerName = array_pop($templatePathParts);
         $allowedExtensions = implode(',', self::$allowedIconTypes);
         $iconFolder = ExtensionManagementUtility::extPath($extensionKey, 'Resources/Public/Icons/' . $controllerName . '/');
         $iconRelFolder = ExtensionManagementUtility::extRelPath($extensionKey) . 'Resources/Public/Icons/' . $controllerName . '/';
         $iconPathAndName = $iconFolder . $templateName;
         $iconMatchPattern = $iconPathAndName . '.{' . $allowedExtensions . '}';
         $filesInFolder = TRUE === is_dir($iconFolder) ? glob($iconMatchPattern, GLOB_BRACE) : array();
         $iconFile = TRUE === is_array($filesInFolder) && 0 < count($filesInFolder) ? reset($filesInFolder) : NULL;
         $iconRelPathAndFilename = FALSE === is_null($iconFile) ? $iconRelFolder . str_replace($iconFolder, '', $iconFile) : NULL;
         return $iconRelPathAndFilename;
     }
     return NULL;
 }
예제 #23
0
 /**
  * @test
  * @dataProvider getPreviewTestOptions
  * @param array $options
  * @param string $finalAssertionMethod
  * @return void
  */
 public function rendersPreviews(array $options, $finalAssertionMethod)
 {
     $provider = $this->objectManager->get('FluidTYPO3\\Flux\\Provider\\Provider');
     $form = Form::create(array('name' => 'test', 'options' => array('preview' => $options)));
     $grid = Form\Container\Grid::create(array());
     $grid->createContainer('Row', 'row')->createContainer('Column', 'column');
     $provider->setGrid($grid);
     $provider->setForm($form);
     $provider->setTemplatePaths(array());
     $provider->setTemplatePathAndFilename($this->getAbsoluteFixtureTemplatePathAndFilename(self::FIXTURE_TEMPLATE_PREVIEW));
     $previewView = $this->getMock($this->createInstanceClassName(), array('registerTargetContentAreaInSession'));
     $previewView->expects($this->any())->method('registerTargetContentAreaInSession');
     $previewView->injectConfigurationService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\FluxService'));
     $previewView->injectConfigurationManager($this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager'));
     $previewView->injectWorkspacesAwareRecordService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService'));
     $preview = $previewView->getPreview($provider, Records::$contentRecordIsParentAndHasChildren);
     $this->{$finalAssertionMethod}($preview);
 }
 /**
  * @param Form $form
  * @return string
  */
 protected function buildShowItemList(Form $form)
 {
     $parts = array();
     foreach ($form->getSheets(FALSE) as $sheet) {
         array_push($parts, '--div--;' . $sheet->getLabel());
         foreach ($sheet->getFields() as $field) {
             array_push($parts, $field->getName());
         }
     }
     return implode(', ', $parts);
 }
예제 #25
0
 /**
  * @param array $settings
  * @return void
  */
 public function loadSettings(array $settings)
 {
     if (TRUE === isset($settings['name'])) {
         $this->setName($settings['name']);
     }
     if (TRUE === isset($settings['form'])) {
         $form = Form::create($settings['form']);
         if (TRUE === isset($settings['extensionKey'])) {
             $extensionKey = $settings['extensionKey'];
             $extensionName = ExtensionNamingUtility::getExtensionName($extensionKey);
             $form->setExtensionName($extensionName);
         }
         $settings['form'] = $form;
     }
     if (TRUE === isset($settings['grid'])) {
         $settings['grid'] = Grid::create($settings['grid']);
     }
     foreach ($settings as $name => $value) {
         $this->{$name} = $value;
     }
     $fieldName = $this->getFieldName(array());
     if (TRUE === isset($settings['listType'])) {
         $listType = $settings['listType'];
         $GLOBALS['TCA'][$this->tableName]['types']['list']['subtypes_addlist'][$listType] = $fieldName;
     }
     $GLOBALS['TCA'][$this->tableName]['columns'][$fieldName]['config']['type'] = 'flex';
 }
예제 #26
0
 /**
  * @return array
  */
 public function getConvertFlexFormContentToArrayTestValues()
 {
     return array(array('', NULL, '', '', array()), array('', Form::create(), '', '', array()), array(Xml::SIMPLE_FLEXFORM_SOURCE_DEFAULT_SHEET_ONE_FIELD, Form::create(), '', '', array('settings' => array('input' => 0))));
 }
예제 #27
0
 /**
  * @test
  */
 public function canSetForm()
 {
     $form = Form::create(array('name' => 'test'));
     $record = Records::$contentRecordWithoutParentAndWithoutChildren;
     $provider = $this->getConfigurationProviderInstance();
     $provider->setForm($form);
     $this->assertSame($form, $provider->getForm($record));
 }
예제 #28
0
파일: Core.php 프로젝트: fluidtypo3/flux
 /**
  * Registers a Form instance to use when TCA for a model object class/table is requested.
  *
  * @param string $className
  * @param Form $form
  * @return void
  */
 public static function registerFormForModelObjectClassName($className, Form $form = NULL)
 {
     if (NULL !== $form && TRUE === isset($GLOBALS['_EXTKEY']) && NULL === $form->getExtensionName()) {
         $form->setExtensionName(GeneralUtility::underscoredToUpperCamelCase($GLOBALS['_EXTKEY']));
     }
     self::$forms['models'][$className] = $form;
 }
예제 #29
0
 /**
  * @param Form $form
  * @param array $row
  * @return Form
  */
 protected function setDefaultValuesInFieldsWithInheritedValues(Form $form, array $row)
 {
     foreach ($form->getFields() as $field) {
         $name = $field->getName();
         $inheritedValue = $this->getInheritedPropertyValueByDottedPath($row, $name);
         if (NULL !== $inheritedValue && TRUE === $field instanceof FieldInterface) {
             $field->setDefault($inheritedValue);
         }
     }
     return $form;
 }
 /**
  * @test
  */
 public function canGetGridWhenItDoesNotExistAndStorageDoesNotExist()
 {
     $form = Form::create();
     $instance = $this->createMockedInstanceForVariableContainerTests();
     ObjectAccess::getProperty($instance, 'viewHelperVariableContainer', TRUE)->expects($this->any())->method('exists')->will($this->returnValue(FALSE));
     ObjectAccess::getProperty($instance, 'templateVariableContainer', TRUE)->expects($this->any())->method('exists')->will($this->returnValue(TRUE));
     ObjectAccess::getProperty($instance, 'templateVariableContainer', TRUE)->expects($this->any())->method('get')->will($this->returnValue($form));
     $output = $this->callInaccessibleMethod($instance, 'getGrid');
     $this->assertInstanceOf('FluidTYPO3\\Flux\\Form\\Container\\Grid', $output);
 }