Project

General

Profile

Actions

Bug #82762

closed

It' not possible to provide render types for passthrough

Added by Daniel Siepmann about 7 years ago. Updated about 6 years ago.

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

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

As passthrough is the only field not processed for database, it's the only possible TCA type to implement custom information display without adding non existing columns to list view.

Therefore it should be either possible to add custom render types to implement custom renderings for passthrough, or to add a switch to tca type `user` to prevent it from being fetched from database.

Usecase:
We want to add a google map to a record. This map is generated using two additional columns `lat` and `lng`. Also we need to register a new column in TCA to render the map itself, which is not available in database as nothing is stored.
We either can use a new `renderMode` or a TCA column of type `user`.
Both get fetched from database in list view when editor selects the field, which is possible.

It's not possible to select `passthrough` fields in this view. So either there should be a switch for `user` to prevent columns from being processed, or process `passthrough` as usual by node factory, exactly https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_8-7/typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php#L79 .

Actions #1

Updated by Daniel Siepmann about 7 years ago

The following is a working workaround:

typo3conf/ext/cdx_feuser_locations/Classes/Form/Container/SingleFieldContainer.php:

<?php
namespace Codappix\CdxFeuserLocations\Form\Container;

/*
 * Copyright (C) 2017  Daniel Siepmann <coding@daniel-siepmann.de>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

use TYPO3\CMS\Backend\Form\Container\SingleFieldContainer as CoreSingleFieldContainer;

/**
 * Extend original SingleFieldContainer to allow render type resolving for
 * passthrough fields.
 *
 * Workaround for https://forge.typo3.org/issues/82762
 */
class SingleFieldContainer extends CoreSingleFieldContainer
{
    public function render() : array
    {
        $resultArray = parent::render();
        $fieldConfig = $this->data['processedTca']['columns'][$this->data['fieldName']];

        if ($fieldConfig['config']['type'] !== 'passthrough') {
            return $resultArray;
        }

        $options = $this->data;
        $options['parameterArray'] = [
            'fieldConf' => $fieldConfig,
            'itemFormElValue' => $this->data['databaseRow'][$this->data['fieldName']],
        ];
        $options['renderType'] = 'passthrough';

        if (!empty($options['parameterArray']['fieldConf']['config']['renderType'])) {
            $options['renderType'] = $options['parameterArray']['fieldConf']['config']['renderType'];
        }

        return $this->nodeFactory->create($options)->render();
    }
}

typo3conf/ext/cdx_feuser_locations/ext_tables.php:

        $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][$extKey . '-singleFieldContainer'] = [
            'nodeName' => 'singleFieldContainer',
            'priority' => 10,  
            'class' => \Codappix\CdxFeuserLocations\Form\Container\SingleFieldContainer::class,
        ];

Actions #2

Updated by Christian Kuhn about 7 years ago

  • Status changed from New to Needs Feedback

Could you check if type=none with an own renderType elemnt fits your needs?

Actions #3

Updated by Susanne Moog almost 7 years ago

  • Target version deleted (9.0)
Actions #4

Updated by Alexander Opitz over 6 years ago

No feedback within the last 90 days => closing this issue.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Thank you and best regards

Actions #5

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Needs Feedback to Closed

status updated - see Alexander's comment

Actions #6

Updated by Christian Kuhn about 6 years ago

i'll improve tca docs a bit to add more details on type=none for this 'virtual' use case.

Actions

Also available in: Atom PDF