/** * Draw the item in the page module * * @param array parameters * @param object the parent object * @return string */ public function pmDrawItem($params, $pObj) { if ($this->extKey != '' && t3lib_extMgm::isLoaded($this->extKey) && in_array(intval($pObj->pageRecord['doktype']), array(1, 2, 5)) && $params['row']['pi_flexform'] != '') { tx_div2007_ff::load($params['row']['pi_flexform'], $this->extKey); $codes = 'CODE: ' . tx_div2007_ff::get($this->extKey, 'display_mode'); } return $codes; }
/** * Returns the values from the setup field or the field of the flexform converted into the value * The default value will be used if no return value would be available. * This can be used fine to get the CODE values or the display mode dependant if flexforms are used or not. * And all others fields of the flexforms can be read. * * example: * $config['code'] = tx_div2007_alpha::getSetupOrFFvalue_fh003( * $cObj, * $this->conf['code'], * $this->conf['code.'], * $this->conf['defaultCode'], * $this->cObj->data['pi_flexform'], * 'display_mode', * $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][TT_PRODUCTS_EXTkey]['useFlexforms']); * * You have to call $this->pi_initPIflexForm(); before you call this method! * @param object tx_div2007_alpha_language_base object * @param string TypoScript configuration * @param string extended TypoScript configuration * @param string default value to use if the result would be empty * @param boolean if flexforms are used or not * @param string name of the flexform which has been used in ext_tables.php * $TCA['tt_content']['types']['list']['subtypes_addlist']['5']='pi_flexform'; * @return string name of the field to look for in the flexform * @access public * */ function getSetupOrFFvalue_fh003($cObj, $code, $codeExt, $defaultCode, $T3FlexForm_array, $fieldName = 'display_mode', $bUseFlexforms = TRUE, $sheet = 'sDEF', $lang = 'lDEF', $value = 'vDEF') { $rc = ''; if (is_object($cObj)) { if (empty($code)) { if ($bUseFlexforms) { // Converting flexform data into array: $rc = tx_div2007_ff::get($T3FlexForm_array, $fieldName, $sheet, $lang, $value); } else { $rc = strtoupper(trim($cObj->stdWrap($code, $codeExt))); } if (empty($rc)) { $rc = strtoupper($defaultCode); } } else { $rc = $code; } } else { $rc = 'error in call of tx_div2007_alpha::getSetupOrFFvalue_fh003: parameter $cObj is not an object'; debug($rc, '$rc'); // keep this } return $rc; }
/** * Return value from somewhere inside the loaded flexForm structure * * @param mixed $flexForm, (optional) a flexForm array or a key array that contains a flexform * @param string $fieldName, Field name to extract. Can be given like "test/el/2/test/el/field_templateObject" where each part will dig a level deeper in the FlexForm data. * @param string $sheet Sheet pointer, eg. "sDEF" * @param string $lang Language pointer, eg. "lDEF" * @param string $value Value pointer, eg. "vDEF" * @return array The content. */ function get() { //true when the first arguement is a flexForm or a reference to flexForm if (is_array(func_get_arg(0)) || array_key_exists(func_get_arg(0), tx_div2007_ff::$flexForms)) { //case 1, $args 1 is an array... case 2, $args 1 is a key array that contains a flexform is_array(func_get_arg(0)) ? $_flexForm = func_get_arg(0) : ($_flexForm =& tx_div2007_ff::getFlexForm(func_get_arg(0))); $index = 1; } else { $_flexForm =& self::$flexForm; $index = 0; } $fieldName = func_get_arg($index); @func_get_arg($index + 1) ? $sheet = func_get_arg($index + 1) : ($sheet = 'sDEF'); @func_get_arg($index + 2) ? $lang = func_get_arg($index + 2) : ($lang = 'lDEF'); @func_get_arg($index + 3) ? $value = func_get_arg($index + 3) : ($value = 'vDEF'); is_array($_flexForm) ? $sheetArray = $_flexForm['data'][$sheet][$lang] : ($sheetArray = ''); $result = null; if (is_array($sheetArray)) { $result = self::_getFFValueFromSheetArray($sheetArray, explode('/', $fieldName), $value); } return $result; }