本文整理汇总了PHP中FluidTYPO3\Flux\Form::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getOption方法的具体用法?PHP Form::getOption怎么用?PHP Form::getOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidTYPO3\Flux\Form
的用法示例。
在下文中一共展示了Form::getOption方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
$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'];
}
示例2: 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();
}
示例3: getIconForTemplate
/**
* 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;
}
示例4: processFormForTable
/**
* @param string $table
* @param Form $form
*/
protected function processFormForTable($table, Form $form)
{
$extensionName = $form->getExtensionName();
$extensionKey = ExtensionNamingUtility::getExtensionKey($extensionName);
$tableConfiguration = self::$tableTemplate;
$fields = array();
$labelFields = $form->getOption(Form::OPTION_TCA_LABELS);
$enableColumns = array();
foreach ($form->getFields() as $field) {
$name = $field->getName();
// note: extracts the TCEforms sub-array from the configuration, as required in TCA.
$fields[$name] = array_pop($field->build());
}
if (TRUE === $form->getOption(Form::OPTION_TCA_HIDE)) {
$enableColumns['disabled'] = 'hidden';
}
if (TRUE === $form->getOption(Form::OPTION_TCA_START)) {
$enableColumns['start'] = 'starttime';
}
if (TRUE === $form->getOption(Form::OPTION_TCA_END)) {
$enableColumns['end'] = 'endtime';
}
if (TRUE === $form->getOption(Form::OPTION_TCA_FEGROUP)) {
$enableColumns['fe_group'] = 'fe_group';
}
$tableConfiguration['iconfile'] = ExtensionManagementUtility::extRelPath($extensionKey) . $form->getOption(Form::OPTION_ICON);
$tableConfiguration['enablecolumns'] = $enableColumns;
$tableConfiguration['title'] = $form->getLabel();
$tableConfiguration['languageField'] = 'sys_language_uid';
$showRecordsFieldList = $this->buildShowItemList($form);
$GLOBALS['TCA'][$table] = array('ctrl' => $tableConfiguration, 'interface' => array('showRecordFieldList' => implode(',', array_keys($fields))), 'columns' => $fields, 'types' => array(0 => array('showitem' => $showRecordsFieldList)));
if (TRUE === $form->getOption(Form::OPTION_TCA_DELETE)) {
$GLOBALS['TCA'][$table]['ctrl']['delete'] = 'deleted';
}
if (NULL === $labelFields) {
reset($fields);
$GLOBALS['TCA'][$table]['ctrl']['label'] = key($fields);
} else {
$GLOBALS['TCA'][$table]['ctrl']['label'] = array_shift($labelFields);
$GLOBALS['TCA'][$table]['ctrl']['label_alt'] = implode(',', $labelFields);
}
}
示例5: convertFlexFormContentToArray
/**
* Parses the flexForm content and converts it to an array
* The resulting array will be multi-dimensional, as a value "bla.blubb"
* results in two levels, and a value "bla.blubb.bla" results in three levels.
*
* Note: multi-language flexForms are not supported yet
*
* @param string $flexFormContent flexForm xml string
* @param Form $form An instance of \FluidTYPO3\Flux\Form. If transformation instructions are contained in this configuration they are applied after conversion to array
* @param string $languagePointer language pointer used in the flexForm
* @param string $valuePointer value pointer used in the flexForm
* @return array the processed array
*/
public function convertFlexFormContentToArray($flexFormContent, Form $form = NULL, $languagePointer = 'lDEF', $valuePointer = 'vDEF')
{
if (TRUE === empty($flexFormContent)) {
return array();
}
$formTranslationDisabled = NULL !== $form && FALSE === (bool) $form->getOption(Form::OPTION_TRANSLATION);
if (TRUE === empty($languagePointer) || TRUE === $formTranslationDisabled) {
$languagePointer = 'lDEF';
}
if (TRUE === empty($valuePointer) || TRUE === $formTranslationDisabled) {
$valuePointer = 'vDEF';
}
$settings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Service\\FlexFormService')->convertFlexFormContentToArray($flexFormContent, $languagePointer, $valuePointer);
if (NULL !== $form) {
/** @var FormDataTransformer $transformer */
$transformer = $this->objectManager->get('FluidTYPO3\\Flux\\Transformation\\FormDataTransformer');
$settings = $transformer->transformAccordingToConfiguration($settings, $form);
}
return $settings;
}
示例6: registerModuleBasedOnFluxForm
/**
* @param string $qualifiedExtensionName
* @param Form $form
* @return void
* @throws \RuntimeException
*/
public function registerModuleBasedOnFluxForm($qualifiedExtensionName, Form $form)
{
$extensionKey = ExtensionNamingUtility::getExtensionKey($qualifiedExtensionName);
$signature = ExtensionNamingUtility::getExtensionSignature($qualifiedExtensionName);
$options = $form->getOption('Fluidbackend');
$formId = $form->getName();
$module = 'web';
if (TRUE === isset($options[Constants::FORM_OPTION_MODULE_GROUP])) {
$module = $options[Constants::FORM_OPTION_MODULE_GROUP];
}
$position = 'before:help';
if (TRUE === isset($options[Constants::FORM_OPTION_MODULE_POSITION])) {
$position = $options[Constants::FORM_OPTION_MODULE_POSITION];
}
$navigationComponent = '';
if (TRUE === isset($options[Constants::FORM_OPTION_MODULE_PAGE_TREE]) && TRUE === (bool) $options[Constants::FORM_OPTION_MODULE_PAGE_TREE]) {
$navigationComponent = 'typo3-pagetree';
}
$icon = MiscellaneousUtility::getIconForTemplate($form);
if (TRUE === empty($icon)) {
$icon = 'EXT:' . $extensionKey . '/ext_icon.gif';
}
if (NULL === $this->getResolver()->resolveFluxControllerClassNameByExtensionKeyAndAction($qualifiedExtensionName, 'render', 'Backend')) {
throw new \RuntimeException('Attempt to register a Backend controller without an associated BackendController. Extension key: ' . $extensionKey, 1368826271);
}
$moduleConfiguration = array('access' => 'user,group', 'icon' => $icon, 'labels' => 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_module_' . $formId . '.xlf');
if (FALSE === empty($navigationComponent)) {
$moduleConfiguration['navigationComponentId'] = $navigationComponent;
}
$moduleSignature = 'tx_' . $signature . '_' . ucfirst($formId);
if (FALSE === isset($GLOBALS['TBE_MODULES'][$module])) {
if (FALSE === strpos($position, ':')) {
if ('top' === $position) {
$temp_TBE_MODULES = array($module => '');
$temp_TBE_MODULES = RecursiveArrayUtility::mergeRecursiveOverrule($temp_TBE_MODULES, $GLOBALS['TBE_MODULES']);
} else {
$temp_TBE_MODULES = (array) $GLOBALS['TBE_MODULES'];
$temp_TBE_MODULES[$module] = '';
}
} else {
list($command, $relativeKey) = explode(':', $position);
foreach ($GLOBALS['TBE_MODULES'] as $key => $val) {
if ($key === $relativeKey) {
if ('before' === $command) {
$temp_TBE_MODULES[$module] = '';
$temp_TBE_MODULES[$key] = $val;
} else {
$temp_TBE_MODULES[$key] = $val;
$temp_TBE_MODULES[$module] = '';
}
} else {
$temp_TBE_MODULES[$key] = $val;
}
}
}
$GLOBALS['TBE_MODULES'] = (array) $temp_TBE_MODULES;
// register pseudo-module acting as group header
$moduleConfiguration['labels'] = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_modulegroup.xlf';
ExtensionUtility::registerModule($qualifiedExtensionName, $module, '', $position, array('Backend' => 'render,save'), $moduleConfiguration);
}
// register individual module in group
$moduleConfiguration['labels'] = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_module_' . $formId . '.xlf';
ExtensionUtility::registerModule($qualifiedExtensionName, $module, $moduleSignature, $position, array('Backend' => 'render,save'), $moduleConfiguration);
}
示例7: buildWizardTabItem
/**
* Builds a single Wizard item (one FCE) based on the
* tab id, element id, configuration array and special
* template identity (groupName:Relative/Path/File.html)
*
* @param string $tabId
* @param string $id
* @param \FluidTYPO3\Flux\Form $form
* @param string $templateFileIdentity
* @return string
*/
protected function buildWizardTabItem($tabId, $id, $form, $templateFileIdentity)
{
$icon = $form->getOption(Form::OPTION_ICON);
$description = $form->getDescription();
if (TRUE === empty($description)) {
$description = '-';
}
$iconFileRelativePath = $icon ? $icon : $this->defaultIcon;
return sprintf('
mod.wizards.newContentElement.wizardItems.%s.elements.%s {
icon = %s
title = %s
description = %s
tt_content_defValues {
CType = fluidcontent_content
tx_fed_fcefile = %s
}
}
', $tabId, $id, $iconFileRelativePath, $form->getLabel(), $description, $templateFileIdentity);
}