本文整理汇总了PHP中FluidTYPO3\Flux\Form类的典型用法代码示例。如果您正苦于以下问题:PHP Form类的具体用法?PHP Form怎么用?PHP Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Form类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
/**
* @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();
}
开发者ID:busynoggin,项目名称:flux,代码行数:13,代码来源:RenderViewHelper.php
示例2: getPostProcessBackendLayoutTestValues
/**
* @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));
}
开发者ID:fluidtypo3,项目名称:fluidpages,代码行数:30,代码来源:BackendLayoutTest.php
示例3: renderStatic
/**
* @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);
}
开发者ID:busynoggin,项目名称:flux,代码行数:40,代码来源:FormViewHelper.php
示例4: render
/**
* 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);
}
开发者ID:JostBaron,项目名称:flux,代码行数:36,代码来源:FormViewHelper.php
示例5: canSetDefaultValueFromCsvfAlreadyCorrectStrings
/**
* @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());
}
开发者ID:busynoggin,项目名称:flux,代码行数:10,代码来源:FileTest.php
示例6: testTransformation
/**
* @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');
}
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:15,代码来源:FormDataTransformerTest.php
示例7: testGetForm
/**
* @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);
}
开发者ID:adrolli,项目名称:fluidcontent_core,代码行数:12,代码来源:CoreContentProviderTest.php
示例8: modifyModifiesFields
/**
* @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());
}
开发者ID:JostBaron,项目名称:flux,代码行数:12,代码来源:SheetTest.php
示例9: triggersDomainModelAnalysisWhenFormsAreRegistered
/**
* @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();
}
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:13,代码来源:TableConfigurationPostProcessorTest.php
示例10: testDetectAndRegisterAllFluidBackendModules
/**
* @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();
}
开发者ID:fluidtypo3,项目名称:fluidbackend,代码行数:13,代码来源:ConfigurationServiceTest.php
示例11: testTransformation
/**
* @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');
}
开发者ID:busynoggin,项目名称:flux,代码行数:17,代码来源:FormDataTransformerTest.php
示例12: testRender
/**
* @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);
}
开发者ID:fluidtypo3,项目名称:flux,代码行数:14,代码来源:RenderViewHelperTest.php
示例13: testRenderWizardTabItem
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);
}
开发者ID:almirbi,项目名称:fluidcontent,代码行数:11,代码来源:ConfigurationServiceTest.php
示例14: testRender
/**
* @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);
}
开发者ID:busynoggin,项目名称:flux,代码行数:15,代码来源:RenderViewHelperTest.php
示例15: getAddSubIconTestValues
/**
* @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'));
}
开发者ID:busynoggin,项目名称:flux,代码行数:15,代码来源:ContentIconHookSubscriberTest.php
示例16: getForm
/**
* @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;
}
开发者ID:JostBaron,项目名称:flux,代码行数:15,代码来源:AbstractFormViewHelper.php
示例17: triggersDomainModelAnalysisWhenFormsAreRegistered
/**
* @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);
}
开发者ID:JostBaron,项目名称:flux,代码行数:15,代码来源:TableConfigurationPostProcessorTest.php
示例18: triggersContentManipulatorOnDatabaseOperationNew
/**
* @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);
}
开发者ID:neufeind,项目名称:flux,代码行数:15,代码来源:ContentProviderTest.php
示例19: testGetCurrentOutlet
/**
* @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);
}
开发者ID:fluidtypo3,项目名称:fluidbackend,代码行数:16,代码来源:AbstractBackendControllerTest.php
示例20: render
/**
* @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'];
}
开发者ID:fluidtypo3,项目名称:flux,代码行数:13,代码来源:RenderViewHelper.php
注:本文中的FluidTYPO3\Flux\Form类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论