Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCA form not saving into database #60

Open
pjope opened this issue Aug 22, 2024 · 1 comment
Open

TCA form not saving into database #60

pjope opened this issue Aug 22, 2024 · 1 comment

Comments

@pjope
Copy link

pjope commented Aug 22, 2024

Hello,

I added the plugin as described, and when I enable it for pages, everything works fine.

Now I tried to add the field only to a specific page doktype, without adding it to the others.

The icon picker is showing up, and I can pick an icon. It is displayed in the field after selection.

However, if I save the record now, nothing is saved to the database.

If I manually edit the record in the database and enter the icon string into the tx_bwicons_icon field, the icon picker field is correctly filled with the correct icon in TYPO3.

(function() {
  $customIconClass = 'apps-pagetree-page-shortcut';

  \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
      'pages',
      'doktype',
      [
          'label' => 'LLL:EXT:portal/Resources/Private/Language/locallang_tca.xlf:PageTypes.socialMedia',
          'value' => 1000,
          'icon' => $customIconClass,
          'group' => 'special',
      ],
  );
  $GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][1000] = $customIconClass;
  $GLOBALS['TCA']['pages']['types'][1000] = [
      'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    doktype,
                    --palette--;;title,
                    'tx_bwicons_icon'
                    --palette--;;external,
                --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.metadata,
                    --palette--;;abstract,
                    --palette--;;editorial,
                --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.appearance,
                    --palette--;;layout,
                --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.behaviour,
                    --palette--;;miscellaneous,
                --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.resources,
                    --palette--;;media,
                    --palette--;;config,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                    --palette--;;language,
                --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
                    --palette--;;visibility,
                    --palette--;;access,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
                    categories,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
                    rowDescription,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
            ',
      'columnsOverrides' => [
          'tx_bwicons_icon' => [
              'label' => 'Icon',
              'config' => [
                  'type' => 'input',
                  'renderType' => 'iconSelection',
              ],
          ],
      ],
  ];
})();

image

Greetings
Phil

@maikschneider
Copy link
Owner

Hey Phil. I'm not sure why the selected icon is not saved correctly. Your config for the doktype 1000 looks a bit strange though:

 --palette--;;title,
                    'tx_bwicons_icon'
                    --palette--;;external,

The quotes around tx_bwicons_icon should not be necessary. The columnsOverrides are not needed as well (the configuration is already done for this field).

Just an idea: If you want to restrict the icon field to only a specific doktype, TCEFORM would be much easier:

# disable the icon field for pages
TCEFORM.pages.tx_bwicons_icon.disabled = 1
# enable the icon field for a specific page type
TCEFORM.pages.tx_bwicons_icon.types.1000.disabled = 0

Try again and let me know. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants