TYPO3 TCA - How to use the "built-in" type without all interface parameters

I am currently working on a project using the t3blog extension. In the backend, when creating a new message, you first enter the header, and then you must click "Create New" to add content to the message.

Ideally, the client wants to remove “create new” or at least create new content by default.

I dig through TCA extensions and I found where it adds this control, now I am a bit stuck as I haven't hacked into TCA yet, does anyone know how to change the "inline" behavior through TCA?

Here is the code that adds the control.

'content' => Array (
        'exclude' => 1,
        'label' => 'LLL:EXT:t3blog/locallang_db.xml:tx_t3blog_post.content',
        'config' => array (
            'type' => 'inline',
            'foreign_table' => 'tt_content',
            'foreign_field' => 'irre_parentid',
            'foreign_table_field' => 'irre_parenttable',
            'maxitems' => 100,
            'appearance' => array(
                'showSynchronizationLink' => 0,
                'showAllLocalizationLink' => 0,
                'showPossibleLocalizationRecords' => 0,
                'showRemovedLocalizationRecords' => 0,
                'expandSingle' => 1
            ),
            'behaviour' => array(
            ),
        )

    ),

What I'm trying to do is delete the created shared tab and just have the text tab.

.

+3
2

, :

TCA :

    'content' => Array (
        'exclude' => 1,
        'label' => 'LLL:EXT:t3blog/locallang_db.xml:tx_t3blog_post.content',
        'config' => array (
            'type' => 'inline',
            'foreign_table' => 'tt_content',
            'foreign_field' => 'irre_parentid',
            'foreign_table_field' => 'irre_parenttable',
            'maxitems' => 100,
            'appearance' => array(
                'showSynchronizationLink' => 0,
                'showAllLocalizationLink' => 0,
                'showPossibleLocalizationRecords' => 0,
                'showRemovedLocalizationRecords' => 0,
                'expandSingle' => 1,
                'collapseAll' => 0
            ),
            'behaviour' => array(
            ),
            't3blog' => true
        )

    )

. ext ext_tables.php :

<?php
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tceforms_inline.php'] = t3lib_extMgm::extPath($_EXTKEY).'ux_inline.php';

ux_inline.php:

<?php
class ux_t3lib_TCEforms_inline extends t3lib_TCEforms_inline
{
    public function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = false)
    {
        if(isset($config['t3blog']) && $config['t3blog'])
        {
            $GLOBALS['TCA']['tt_content']['types']['text']['showitem'] = 'bodytext;;9;richtext:rte_transform[flag=rte_enabled|mode=ts_css];3-3-3';
            $GLOBALS['TCA']['tt_content']['columns']['CType']['exclude'] = 1;
            $GLOBALS['TCA']['tt_content']['columns']['header']['exclude'] = 1;

            return;
        }
        else
        {
            return parent::renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
        }
    }

    public function getExpandedCollapsedState($table, $uid)
    {
        if(isset($_REQUEST['edit']['tx_t3blog_post']))
            return true;
        else
            return parent::getExpandedCollapsedState($table, $uid);
    }

    public function getLevelInteractionLink($type, $objectPrefix, $conf=array())
    {
            if(!isset($conf['t3blog']) || !$conf['t3blog'])
            {
                return parent::getLevelInteractionLink($type, $objectPrefix, $conf);
            }
            else
    {
        if((int) $conf['inline']['first'] > 0)
            return;
    }

    $nameObject = $this->inlineNames['object'];
    $attributes = array();
    switch($type) {
        case 'newRecord':
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.createnew', 1);
            $iconFile = 'gfx/new_el.gif';
            // $iconAddon = 'width="11" height="12"';
            $className = 'typo3-newRecordLink';
            $attributes['class'] = 'inlineNewButton '.$this->inlineData['config'][$nameObject]['md5'];
            $attributes['onclick'] = "return inline.createNewRecord('$objectPrefix')";
            $attributes['style'] = "display: none;";
            if (isset($conf['inline']['inlineNewButtonStyle']) && $conf['inline']['inlineNewButtonStyle']) {
                $attributes['style'] = $conf['inline']['inlineNewButtonStyle'];
            }
            if (isset($conf['appearance']['newRecordLinkAddTitle']) && $conf['appearance']['newRecordLinkAddTitle']) {
                $titleAddon = ' '.$GLOBALS['LANG']->sL($GLOBALS['TCA'][$conf['foreign_table']]['ctrl']['title'], 1);
            }
            $icon = ($iconFile ? '<img'.t3lib_iconWorks::skinImg($this->backPath, $iconFile, $iconAddon).' alt="'.htmlspecialchars($title.$titleAddon).'" />' : '');
            $link = $this->wrapWithAnchor($icon.$title.$titleAddon, '#', $attributes);
            return '<div'.($className ? ' class="'.$className.'"' : '').'>'.$link.'</div>';
            break;
        case 'localize':
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:localizeAllRecords', 1);
            $iconFile = 'gfx/localize_el.gif';
            $className = 'typo3-localizationLink';
            $attributes['onclick'] = "return inline.synchronizeLocalizeRecords('$objectPrefix', 'localize')";
            break;
        case 'synchronize':
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:synchronizeWithOriginalLanguage', 1);
            $iconFile = 'gfx/synchronize_el.gif';
            $className = 'typo3-synchronizationLink';
            $attributes['class'] = 'inlineNewButton '.$this->inlineData['config'][$nameObject]['md5'];
            $attributes['onclick'] = "return inline.synchronizeLocalizeRecords('$objectPrefix', 'synchronize')";
            break;
    }
        // Create the link:

    }
}

, - .

+1

, "inline" , " IRRE ' Inline Relational Record Editing, ( TYPO3) TCA. API TYPO3, .

, Ajax . , , ( , Powermail), , , / T3. , , . , SO TYPO3, ...

+1

Source: https://habr.com/ru/post/1705926/


All Articles