getOption() 공개 메소드

public getOption ( string $name ) : mixed
$name string
리턴 mixed
예제 #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);
     $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
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();
 }
예제 #3
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;
 }
 /**
  * @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
0
 /**
  * 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;
 }
 /**
  * @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
0
    /**
     * 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);
    }