/**
  * @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);
     }
 }
Ejemplo n.º 2
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);
    }