einpraegsam / powermailextended

Example extension how to extend powermail for TYPO3
8 stars 8 forks source link

Accessing Custom Field property (like Readonly) not working with Powermail 8.x #7

Open mfvetter opened 3 years ago

mfvetter commented 3 years ago

Hello! Anyone having issues with TYPO3 10 + Powermail 8 trying to add a custom field (like the Readonly example option based on Powermailextended extension)?

I’m able to have the backdend working with my custom fields, it shows and saves properly on the backend. But I can’t access the new field property values in my Fluid templates. Even the Readonly example from Powermailextened isn’t working.

It was working ok on TYPO3 9.5.x + Powermail 7.x. Any clues are welcomed :)

mfvetter commented 3 years ago

By the way, to avoid an error loading this extension on Typo3 10, I had to adjust line 6 of ext_tables.php to be 'powermailextened' instead of $_EXTKEY.

Mainbird commented 3 years ago

Hi @mfvetter,

you have to do some changes for TYPO3 10.

  1. Migrate config.tx_extbase.persistence (https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.0/Breaking-87623-ReplaceConfigpersistenceclassesTyposcriptConfiguration.html)

EXT:example/Configuration/Extbase/Persistence/Classes.php

<?php
declare(strict_types=1);

return [
    \In2code\Powermail\Domain\Model\Field::class => [
        'subclasses' => [
            0 => \Example\Extension\Domain\Model\PowermailField::class,
        ],
    ],
    \In2code\Powermail\Domain\Model\Page::class => [
        'subclasses' => [
            0 => \Example\Extension\Domain\Model\PowermailPage::class,
        ],
    ],
    \In2code\Powermail\Domain\Model\Form::class => [
        'subclasses' => [
            0 => \Example\Extension\Domain\Model\PowermailForm::class,
        ],
    ],
    \Example\Extension\Domain\Model\PowermailField::class => [
        'tableName' => 'tx_powermail_domain_model_field',
    ],
    \Example\Extension\Domain\Model\PowermailPage::class => [
        'tableName' => 'tx_powermail_domain_model_page',
    ],
    \Example\Extension\Domain\Model\PowermailForm::class => [
        'tableName' => 'tx_powermail_domain_model_form',
    ],
];
  1. Migrate config.tx_extbase.object (https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5/Deprecation-86270-ExtbaseXclassViaTypoScriptSettings.html)

EXT:example/ext_localconf.php

<?php
defined('TYPO3_MODE') || die();

(static function() {
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\In2code\Powermail\Domain\Repository\FormRepository::class] = [
        'className' => \Example\Extension\Domain\Repository\PowermailFormRepository::class
    ];
})();

The rest should be the same. I hope this will help you. :)

agendartobias commented 3 years ago

@Mainbird tnx for your solution, it works for me. I had to do this for Domain\Model\Mail.

Additional i had to define ballow code in ext_localconf.php so i was able to edit forms via. powermail frontend editing

\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class) ->registerImplementation(\In2code\Powermail\Domain\Model\Mail::class, \Ag\AgExtendedpowermail\Domain\Model\Mail::class);

mfvetter commented 3 years ago

@Mainbird, thank you! It worked for me as well.