typo3extbase

How to enable hide button on my typo3 custom ext?


I did an extension that allows you to create custom records (ideas), but this ideas should have the "hidder" field in 1 by default so a back-end user can approve it before displaying it on the front-end. I have, the "hider" column is there, my model has a hide property which I can set in 1 and the record does not get displayed correctly on the front-end but I don't know how to show the "hide record" button on the back-end. I need to display the same hide button that categories but in my custom record "ideas" like. enter image description here

I don't know much about typo3 so I don't know where this is configured. This is my tx file.

<?php
return [
    'ctrl' => [
        'title' => 'LLL:EXT:my_custom_ext/Resources/Private/Language/locallang_db.xlf:hk_ideas_idea',
        'label' => 'title',
        'iconfile' => 'EXT:my_custom_ext/Resources/Public/Icons/Extension.svg',
        'enablecolumns' => [ 
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
    ],
    'columns' => [ ...(noting about hide field here)... ],
    'types' => [
        '0' => ['showitem' => 'title, description, category, status, user, voted_users'],
    ],
];

And this is my tt_content file

<?php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'Vendor.Extension',
    'Ideas',
    'The Ideas Data Record List',
    'EXT:my_custom_ext/Resources/Public/Icons/Extension.svg'
);

Solution

  • Add enable fields to your showitem

    'types' => [
            '0' => ['showitem' => 'title, description, category, status, user, voted_users, hidden, starttime, endtime'],
        ],
    

    in columns section also there will be these configs:

    'hidden' => [
        'exclude' => true,
        'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible',
        'config' => [
            'type' => 'check',
            'renderType' => 'checkboxToggle',
            'items' => [
                [
                    0 => '',
                    1 => '',
                    'invertStateDisplay' => true
                ]
            ],
        ],
    ],
    'starttime' => [
        'exclude' => true,
        'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
        'config' => [
            'type' => 'input',
            'renderType' => 'inputDateTime',
            'eval' => 'datetime,int',
            'default' => 0,
            'behaviour' => [
                'allowLanguageSynchronization' => true
            ]
        ],
    ],
    'endtime' => [
        'exclude' => true,
        'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
        'config' => [
            'type' => 'input',
            'renderType' => 'inputDateTime',
            'eval' => 'datetime,int',
            'default' => 0,
            'range' => [
                'upper' => mktime(0, 0, 0, 1, 1, 2038)
            ],
            'behaviour' => [
                'allowLanguageSynchronization' => true
            ]
        ],
    ],