Project

General

Profile

Actions

Feature #19345

closed

Hook request in TCEforms before procItems() calls

Added by Cyrille over 15 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2008-09-17
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

Description

it would be great to have a hook in functions like getSingleField_typeXXXX() to manipulate data before the procItems call.

Background: while in a flex form, I need to generate options for a select depending on another field.

In most cases, this is no problem as we have access to the flexform and we can parse it and determine the value of the reference field. But in the case of sections and sections in sections (etc...), the code becomes so laborious and so crappy that a simple reference to the current field, as contained in $PA['itemElValue'] would be really helpfull. Unfortunately, the procItems() method doesn't have the full $PA as parameter, thus the hook!

File: t3lib\class.t3lib_tceforms.php
Method: getSingleField_typeSelect (for example) (can apply to other types)
Line: 1405
Example of patch:
[CODE]
function getSingleField_typeSelect($table,$field,$row,&$PA) {
global $TCA, $TYPO3_CONF_VARS;

// First prepare user defined objects (if any) for hooks which extend this function:
$hookObjectsArr = array();
if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleField_typeSelect'])) {
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleField_typeSelect'] as $classRef) {
$hookObjectsArr[] = &t3lib_div::getUserObj($classRef);
}
}
// Field configuration from TCA:
$config = $PA['fieldConf']['config'];
$disabled = '';
if($this->renderReadonly || $config['readOnly']) {
$disabled = ' disabled="disabled"';
}
// "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. See http://typo3.org/documentation/document-library/doc_core_api/Wizards_Configuratio/.
$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']) {
// Hook: getSingleField_typeSelect_preProcItems
foreach($hookObjectsArr as $hookObj) {
if (method_exists($hookObj, 'getSingleField_typeSelect_preProcItems')) {
$hookObj->getSingleField_typeSelect_preProcItems($selItems,$PA,$config,$table,$row,$field, $this);
}
}
$selItems = $this->procItems($selItems,$PA['fieldTSConfig']['itemsProcFunc.'],$config,$table,$row,$field);
}
[/CODE]
(issue imported from #M9371)
Actions #1

Updated by Alexander Opitz about 11 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

As this report is very old, is the handling in newer TYPO3 CMS Versions (like 6.0/6.1) more like you expect it?

Actions #2

Updated by Alexander Opitz over 10 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

Actions

Also available in: Atom PDF