Project

General

Profile

Actions

Feature #72619

closed

Add a possibility to provide custom context information to inline elements

Added by Hannes Lau almost 9 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2016-01-10
Due date:
% Done:

0%

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

Description

Add a hook, signal or configuration options that allows developers to extend the context information that is passed to inline elements. The hook shall allow an implementor to copy data that is provided by the FormDataProviders of the parent element and make it acessible to the FormDataProviders in the InlineParentGroup of the child record.

Use cases:
  • Use parents type value to set the type of an inline child
  • Use parents db field to modify the TCA of the child object
Or more specifically
  • Solve issues like #67611, #71436
  • Provide different crop presets for the sys_file_reference.crop field, depending on the table/type of the record that references the sys_file_reference

… each, by using a custom FormDataProvider in the InlineParentRecord group.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #67611: Parent type in TCA work only after record savingClosed2015-06-18

Actions
Related to TYPO3 Core - Feature #72620: Provide different crop presets depending on the context for image sys_file_referencesClosed2016-01-10

Actions
Actions #1

Updated by Hannes Lau almost 9 years ago

Maybe this belongs in the "IRRE" category. Unfortunately, I do not seem to able to update the description or category.

Actions #2

Updated by Georg Ringer almost 9 years ago

  • Category changed from FormEngine aka TCEforms to 978
Actions #3

Updated by Morton Jonuschat almost 9 years ago

  • Status changed from New to Closed

Using the new FormEngine you already have the option to implement what you are looking for. You can add your own data Providers into the inlineParentRecord group, defined in
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['inlineParentRecord']. At the very least you have the current command, the tablename, the parent row uid and - in context of a flexform - the pointers to the flexform data structure as a starting point.

Using this information your additional data provider can enrich the information in the databaseRow as required, this information will the be available in all following data providers.

Actions #4

Updated by Hannes Lau over 8 years ago

Morton and I talked about this on Slack ~1 month ago.

Unfortunately, adding a custom data provider ist not an option to resolve #67611. The custom data provider would need to fetch the parent record, which is not (yet) available in the DB (see #67611).

The same holds true for #72620: As long as the parent record has not been written to the DB, a custom data provider has no chance to retrieve the necessary information.

With the current architecture, the type information of the parent would need to be passed through the inline record stack (JSON). Unfortunately, there is no entry point in the code, where a developer would be able to extend the information.

Actions #5

Updated by Eike Starkmann over 7 years ago

Stumbled over this in slack.

What i did for an extension Typo3 6.2:

Inline child record:

class FromFields
{
    public function getFields($config, $pObject)
    {
        $parent = $pObject->inline->inlineStructure['stable'][0];
        $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*',$parent['table'],'uid = '.$parent['uid']);
        $tableName = $result['from_table'];

       $filterList = "sys_language_uid,l10n_parent,l10n_diffsource,t3ver_label, hidden,starttime,endtime,tx_extbase_type, petition";

       $result = array();
       $i=0;
        $config['items'] = $GLOBALS['TCA'][$tableName]['columns'];
        foreach($GLOBALS['TCA'][$tableName]['columns'] as $field => $value){
          if(!in_array($field, GeneralUtility::trimExplode(",",$filterList))){
              $result[$i] = array(
                  0 => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($value['label'], '')." ($field)",
                  1 => $field
              );
              $i++;
          }
        }

        $config['items'] = $result;

        return $config;
    }
}

...

'from_field' => array(
            'exclude' => 1,
            'label' => 'LLL:EXT:eventmgmt_importer/Resources/Private/Language/locallang_db.xlf:tx_eventmgmtimporter_domain_model_fieldmapping.from_field',
            'config' => array(
                'type' => 'select',
                'itemsProcFunc' => '\Undkonsorten\EventmgmtImporter\Utility\FromFields->getFields',
                'size' => 1,
                'maxitems' => 1,
                'eval' => 'required'
            ),
        ),

Parent Record:

'requestUpdate' => 'from_table',

Seems to me like a dirty hack and i would love to have a better solution. Also this is not working for >= 7.6

Actions

Also available in: Atom PDF