myComponents: how to prenvent settings removal?

Hello

I’d like to prevent the deletion of context settings created by an extra when this extra is uninstalled.

NB : I use myComponents

Is there a simple way ?

If you find the section of your build.transport.php file that packages the context settings, you’ll see this array:

$attributes = array(
            xPDOTransport::UNIQUE_KEY => 'key',
            xPDOTransport::PRESERVE_KEYS => true,
            xPDOTransport::UPDATE_OBJECT => false,
        );

If the third member (UPDATE_OBJECT) is set to false, the setting should stay when the package is removed.

Also, make sure you’re not removing the settings manually in the UNINSTALL section of any resolvers and validators.

The catch here is that the context settings won’t be upgraded automatically when a new version of the package is installed (i.e., an upgrade). This is usually what you want anyway because you don’t want to revert any changes the user has made to the setting. If you do want to change something (e.g., a lexicon key), you can do it in a resolver.

1 Like