action = $action; $this->locales = $locales; $sidebarOptions = []; $enabledOptions = []; $disabledOptions = []; $currentBlocks = (array) $context->getData('sidebar'); $plugins = PluginRegistry::loadCategory('blocks', true); foreach ($currentBlocks as $plugin) { if (isset($plugins[$plugin])) { $enabledOptions[] = [ 'value' => $plugin, 'label' => htmlspecialchars($plugins[$plugin]->getDisplayName()), ]; } } foreach ($plugins as $pluginName => $plugin) { if (!in_array($pluginName, $currentBlocks)) { $disabledOptions[] = [ 'value' => $pluginName, 'label' => htmlspecialchars($plugin->getDisplayName()), ]; } } $sidebarOptions = array_merge($enabledOptions, $disabledOptions); $this->addField(new FieldUploadImage('pageHeaderLogoImage', [ 'label' => __('manager.setup.logo'), 'value' => $context->getData('pageHeaderLogoImage'), 'isMultilingual' => true, 'baseUrl' => $baseUrl, 'options' => [ 'url' => $temporaryFileApiUrl, ], ])) ->addField(new FieldUploadImage('homepageImage', [ 'label' => __('manager.setup.homepageImage'), 'tooltip' => __('manager.setup.homepageImage.description'), 'value' => $context->getData('homepageImage'), 'isMultilingual' => true, 'baseUrl' => $baseUrl, 'options' => [ 'url' => $temporaryFileApiUrl, ], ])) ->addField(new FieldRichTextarea('pageFooter', [ 'label' => __('manager.setup.pageFooter'), 'tooltip' => __('manager.setup.pageFooter.description'), 'isMultilingual' => true, 'value' => $context->getData('pageFooter'), 'toolbar' => 'bold italic superscript subscript | link | blockquote bullist numlist | image | code', 'plugins' => 'paste,link,lists,image,code', 'uploadUrl' => $imageUploadUrl, ])) ->addField(new FieldOptions('sidebar', [ 'label' => __('manager.setup.layout.sidebar'), 'isOrderable' => true, 'value' => $currentBlocks, 'options' => $sidebarOptions, ])); } }