Feature #17297 » 0005610_v3.patch
t3lib/class.t3lib_tceforms.php (Arbeitskopie) | ||
---|---|---|
$specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
|
||
// Getting the selector box items from the system
|
||
$selItems = $this->addSelectOptionsToItemArray($this->initItemArray($PA['fieldConf']),$PA['fieldConf'],$this->setTSconfig($table,$row),$field);
|
||
$selItems = $this->addItems($selItems,$PA['fieldTSConfig']['addItems.']);
|
||
if ($config['itemsProcFunc']) $selItems = $this->procItems($selItems,$PA['fieldTSConfig']['itemsProcFunc.'],$config,$table,$row,$field);
|
||
$selItems = $this->addSelectOptionsToItemArray(
|
||
$this->initItemArray($PA['fieldConf']),
|
||
$PA['fieldConf'],
|
||
$this->setTSconfig($table, $row),
|
||
$field
|
||
);
|
||
// Possibly filter some items:
|
||
$filterFunc = create_function('$value', 'return $value[1];');
|
||
$selItems = t3lib_div::filterArray($selItems, $PA['fieldTSConfig']['filterItems'], $filterFunc);
|
||
// Possibly add some items:
|
||
$selItems = $this->addItems($selItems, $PA['fieldTSConfig']['addItems.']);
|
||
if ($config['itemsProcFunc']) {
|
||
$selItems = $this->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field);
|
||
}
|
||
// Possibly remove some items:
|
||
$removeItems = t3lib_div::trimExplode(',',$PA['fieldTSConfig']['removeItems'],1);
|
||
... | ... | |
// Get "removeItems":
|
||
$removeItems = t3lib_div::trimExplode(',',$PA['fieldTSConfig']['removeItems'],1);
|
||
// Get the array with selected items:
|
||
$itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1);
|
||
// Possibly filter some items:
|
||
$filterFunc = create_function('$value', '$parts=explode(\'|\',$value,2); return rawurldecode($parts[0]);');
|
||
$itemArray = t3lib_div::filterArray($itemArray, $PA['fieldTSConfig']['filterItems'], $filterFunc);
|
||
// Perform modification of the selected items array:
|
||
$itemArray = t3lib_div::trimExplode(',',$PA['itemFormElValue'],1);
|
||
foreach($itemArray as $tk => $tv) {
|
||
$tvP = explode('|',$tv,2);
|
||
$evalValue = rawurldecode($tvP[0]);
|
t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie) | ||
---|---|---|
|
||
if ($foreignConfig['type'] == 'select') {
|
||
// Getting the selector box items from the system
|
||
$selItems = $this->fObj->addSelectOptionsToItemArray($this->fObj->initItemArray($PA['fieldConf']),$PA['fieldConf'],$this->fObj->setTSconfig($table,$row),$field);
|
||
if ($config['itemsProcFunc']) $selItems = $this->fObj->procItems($selItems,$PA['fieldTSConfig']['itemsProcFunc.'],$config,$table,$row,$field);
|
||
$selItems = $this->fObj->addSelectOptionsToItemArray(
|
||
$this->fObj->initItemArray($PA['fieldConf']),
|
||
$PA['fieldConf'],
|
||
$this->fObj->setTSconfig($table, $row),
|
||
$field
|
||
);
|
||
// Possibly filter some items:
|
||
$filterFunc = create_function('$value', 'return $value[1];');
|
||
$selItems = t3lib_div::filterArray($selItems, $PA['fieldTSConfig']['filterItems'], $filterFunc);
|
||
// Possibly add some items:
|
||
$selItems = $this->addItems($selItems, $PA['fieldTSConfig']['addItems.']);
|
||
if (isset($config['itemsProcFunc']) && $config['itemsProcFunc']) {
|
||
$selItems = $this->fObj->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field);
|
||
}
|
||
|
||
// Possibly remove some items:
|
||
$removeItems = t3lib_div::trimExplode(',',$PA['fieldTSConfig']['removeItems'],1);
|
t3lib/class.t3lib_div.php (Arbeitskopie) | ||
---|---|---|
}
|
||
/**
|
||
* Filters an array to reduce its elements to match the condition.
|
||
* The values in $filterItems can be optionally evaluated by a custom callback function.
|
||
*
|
||
* Example (arguments used to call this function):
|
||
* $array = array(
|
||
* array('aa' => array('first', 'second'),
|
||
* array('bb' => array('third', 'fourth'),
|
||
* array('cc' => array('fifth', 'sixth'),
|
||
* );
|
||
* $filterItems = array('third');
|
||
* $getFilterValueFunc = create_function('$value', 'return $value[0];');
|
||
*
|
||
* Returns:
|
||
* array(
|
||
* array('bb' => array('third', 'fourth'),
|
||
* )
|
||
*
|
||
* @param array $array: The initial array to be filtered/reduced
|
||
* @param mixed $filterItems: The items which are allowed in the array (=filter) - accepts array or csv string
|
||
* @param string $getFilterValueFunc: (optional) Unique function name set by create_function()
|
||
* @return array The filtered/reduced array
|
||
*/
|
||
public function filterArray($array, $filterItems, $getFilterValueFunc=null) {
|
||
// Convert strings to arrays:
|
||
if (is_string($filterItems)) {
|
||
$filterItems = t3lib_div::trimExplode(',', $filterItems);
|
||
}
|
||
// Do the filtering:
|
||
if (is_array($array) && is_string($getFilterValueFunc) && is_array($filterItems) && count($filterItems)) {
|
||
foreach ($array as $key => $value) {
|
||
// Get the value to compare by using the callback function:
|
||
$filterValue = (isset($getFilterValueFunc) ? $getFilterValueFunc($value) : $value);
|
||
if (!in_array($filterValue, $filterItems)) {
|
||
unset($array[$key]);
|
||
}
|
||
}
|
||
}
|
||
return $array;
|
||
}
|
||
/**
|
||
* Implodes a multidim-array into GET-parameters (eg. ¶m[key][key2]=value2¶m[key][key3]=value3)
|
||
* Usage: 24
|
||
*
|
typo3/sysext/cms/layout/db_new_content_el.php (Arbeitskopie) | ||
---|---|---|
t3lib_div::loadTCA('tt_content');
|
||
// Get TCEFORM from TSconfig of current page
|
||
$row = array('pid'=>$this->id);
|
||
$TCEFORM_TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig('tt_content',$row);
|
||
$removeItems = t3lib_div::trimExplode(',',$TCEFORM_TSconfig['CType']['removeItems'],1);
|
||
$row = array('pid' => $this->id);
|
||
$TCEFORM_TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig('tt_content', $row);
|
||
$removeItems = t3lib_div::trimExplode(',', $TCEFORM_TSconfig['CType']['removeItems'], 1);
|
||
$filterItems = t3lib_div::trimExplode(',', $TCEFORM_TSconfig['CType']['filterItems'], 1);
|
||
$headersUsed = Array();
|
||
// Traverse wizard items:
|
||
... | ... | |
if (is_array($TCA['tt_content']['columns'][$fN])) {
|
||
// Get information about if the field value is OK:
|
||
$config = &$TCA['tt_content']['columns'][$fN]['config'];
|
||
$authModeDeny = $config['type']=='select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode('tt_content',$fN,$fV,$config['authMode']);
|
||
$authModeDeny = ($config['type']=='select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode('tt_content', $fN, $fV, $config['authMode']));
|
||
$isRemovedByFilter = (count($filterItems) && !in_array($fV, $filterItems));
|
||
if ($authModeDeny || ($fN=='CType' && in_array($fV,$removeItems))) {
|
||
if ($authModeDeny || ($fN=='CType' && in_array($fV,$removeItems)) || $isRemovedByFilter) {
|
||
// Remove element all together:
|
||
unset($wizardItems[$key]);
|
||
break;
|