/** * Render tree widget * * @return array As defined in initializeResultArray() of AbstractNode */ public function render() { $table = $this->globalOptions['table']; $field = $this->globalOptions['fieldName']; $row = $this->globalOptions['databaseRow']; $parameterArray = $this->globalOptions['parameterArray']; // Field configuration from TCA: $config = $parameterArray['fieldConf']['config']; $disabled = ''; if ($this->isGlobalReadonly() || $config['readOnly']) { $disabled = ' disabled="disabled"'; } $resultArray = $this->initializeResultArray(); // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. $specConf = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']); $selItems = FormEngineUtility::getSelectItems($table, $field, $row, $parameterArray); $html = $this->renderField($table, $field, $row, $parameterArray, $config, $selItems); // Wizards: if (!$disabled) { $altItem = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />'; $html = $this->renderWizards(array($html, $altItem), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf); } $resultArray['html'] = $html; return $resultArray; }
/** * Render check boxes * * @return array As defined in initializeResultArray() of AbstractNode */ public function render() { $table = $this->globalOptions['table']; $field = $this->globalOptions['fieldName']; $row = $this->globalOptions['databaseRow']; $parameterArray = $this->globalOptions['parameterArray']; // Field configuration from TCA: $config = $parameterArray['fieldConf']['config']; $disabled = ''; if ($this->isGlobalReadonly() || $config['readOnly']) { $disabled = ' disabled="disabled"'; } $this->resultArray = $this->initializeResultArray(); // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. $specConf = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']); $selItems = FormEngineUtility::getSelectItems($table, $field, $row, $parameterArray); // Creating the label for the "No Matching Value" entry. $noMatchingLabel = isset($parameterArray['fieldTSConfig']['noMatchingValue_label']) ? $this->getLanguageService()->sL($parameterArray['fieldTSConfig']['noMatchingValue_label']) : '[ ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue') . ' ]'; $html = $this->getSingleField_typeSelect_checkbox($table, $field, $row, $parameterArray, $config, $selItems, $noMatchingLabel); // Wizards: if (!$disabled) { $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf); } $this->resultArray['html'] = $html; return $this->resultArray; }
/** * If the select field is build by a foreign_table the related UIDs * will be returned. * * Otherwise the label of the currently selected value will be written * to the alternativeFieldValue class property. * * @param array $fieldConfig The "config" section of the TCA for the current select field. * @param string $fieldName The name of the select field. * @param string $value The current value in the local record, usually a comma separated list of selected values. * @return array Array of related UIDs. */ protected function getRelatedSelectFieldUids(array $fieldConfig, $fieldName, $value) { $relatedUids = array(); $isTraversable = FALSE; if (isset($fieldConfig['foreign_table'])) { $isTraversable = TRUE; // if a foreign_table is used we pre-filter the records for performance $fieldConfig['foreign_table_where'] .= ' AND ' . $fieldConfig['foreign_table'] . '.uid IN (' . $value . ')'; } $PA = array(); $PA['fieldConf']['config'] = $fieldConfig; $PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($this->currentTable, $this->currentRow, $fieldName); $PA['fieldConf']['config'] = FormEngineUtility::overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']); $selectItemArray = FormEngineUtility::getSelectItems($this->currentTable, $fieldName, $this->currentRow, $PA); if ($isTraversable && !empty($selectItemArray)) { $this->currentTable = $fieldConfig['foreign_table']; $relatedUids = $this->getSelectedValuesFromSelectItemArray($selectItemArray, $value); } else { $selectedLabels = $this->getSelectedValuesFromSelectItemArray($selectItemArray, $value, 1, TRUE); if (count($selectedLabels) === 1) { $this->alternativeFieldValue = $selectedLabels[0]; $this->forceAlternativeFieldValueUse = TRUE; } } return $relatedUids; }