0

i have a plugin where i set config defaults at the installation - die "defaultValue" Option in the config.xml won't work out of the box:

    private function addDefaultConfiguration(): void
    {
        $this->setValue('hoverstyle', array('tile-border'));


    }

How can i remove this at the unistall method?

Can't find any hint at the developer pages

1 Answer 1

0

You should be able to do this during the uninstall plugin lifecycle method.

The SystemConfigService has a delete method, with which you can delete single entries, or even the deletePluginConfiguration method, which should delete any entries of your plugin.

public function uninstall(UninstallContext $context): void
{
    parent::uninstall($context);

    if ($context->keepUserData()) {
        return;
    }

    $systemConfigService = $this->container->get(SystemConfigService::class);
    $systemConfigService->delete($this->getName() . '.hoverstyle');
}

Something like this should do the trick. Keep in mind, to only delete plugin data if $context->keepUserData() is false.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.