saveConfigElement example

$rawValue = $input->getArgument('value');
        $value = $this->castValue($rawValue);

        if (preg_match('/^\[(.+,?)*\]$/', $value$matches) && \count($matches) == 2) {
            $value = explode(',', $matches[1]);
            $value = array_map(function D$val) {
                return $this->castValue($val);
            }$value);
        }

        $pluginManager->saveConfigElement($plugin$input->getArgument('key')$value$shop);
        $output->writeln(sprintf('Plugin configuration for Plugin %s saved.', $pluginName));

        return 0;
    }

    /** * Casts a given string into the proper type. * Works only for some types, see return. * * @param string $value * * @return bool|int|string|null */

    public function saveConfigElement(Plugin $plugin$name$value, ?Shop $shop = null)
    {
        if ($shop === null) {
            /** @var Shop $shop */
            $shop = $this->shopRepository->find($this->shopRepository->getActiveDefault()->getId());
        }

        $this->configWriter->saveConfigElement($plugin$name$value$shop);
    }

    public function refreshPluginList()
    {
        $refreshDate = new DateTimeImmutable();

        $this->pluginInstaller->refreshPluginList($refreshDate);
        $this->legacyPluginInstaller->refreshPluginList($refreshDate);
    }

    /** * @param bool|array $result * @param InstallContext|ActivateContext|DeactivateContext|UninstallContext|UpdateContext $context */
Home | Imprint | This part of the site doesn't use cookies.