FluidTYPO3\Flux\Form::build PHP Méthode

build() public méthode

public build ( ) : array
Résultat array
    public function build()
    {
        $translateOption = $this->getOption(self::OPTION_TRANSLATION);
        $translateOption = TRUE === empty($translateOption) ? self::TRANSLATION_DISABLED : $translateOption;
        $disableLocalisation = self::TRANSLATION_DISABLED === $translateOption ? 1 : 0;
        $inheritLocalisation = self::TRANSLATION_INHERIT === $translateOption ? 1 : 0;
        $dataStructArray = array('meta' => array('langDisable' => $disableLocalisation, 'langChildren' => $inheritLocalisation));
        $copy = clone $this;
        foreach ($this->getSheets(TRUE) as $sheet) {
            if (FALSE === $sheet->hasChildren()) {
                $copy->remove($sheet->getName());
            }
        }
        $sheets = $copy->getSheets();
        $compactExtensionToggleOn = 0 < $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['flux']['setup']['compact'];
        $compactConfigurationToggleOn = 0 < $copy->getCompact();
        if (($compactExtensionToggleOn || $compactConfigurationToggleOn) && 1 === count($sheets)) {
            $dataStructArray = $copy->last()->build();
            $dataStructArray['meta'] = array('langDisable' => $disableLocalisation);
            unset($dataStructArray['ROOT']['TCEforms']);
        } elseif (0 < count($sheets)) {
            $dataStructArray['sheets'] = $copy->buildChildren($this->children);
        } else {
            $dataStructArray['ROOT'] = array('type' => 'array', 'el' => array());
        }
        return $dataStructArray;
    }

Usage Example

Exemple #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'];
 }