我想扩展SW的响应主题,添加一些自定义配置,但不显示主要主题配置。
到目前为止我做了什么:
编辑Theme.php以包含以下内容:
public function createConfig(Form\Container\TabContainer $container) {
$fieldset = $this->createFieldSet(
'my_custom_settings',
'My custom settings'
);
$tab = $this->createTab(
'my_custom_tab',
'My custom tab'
);
$tab->addElement($fieldset);
$container->addTab($tab);
仅此一点导致主题无法从后端编译。我做错了吗?
ParseError:第1行第3152行1 |的意外输入@setPrecomposed:1; @offcanvasCart:1; @offcanvasOverlayPage:1; @focusSearch :; @ displaySidebar:1; @checkoutHeader:1; @checkoutFooter:1; @infiniteScrolling:1; @infiniteThreshold:4; @lightboxZoomFactor:0; @ brand-primary:#000; @ brand-primary-light:饱和(减轻(@ brand-primary,12%),5%); @ brand-secondary:#5F7285; @ brand-secondary-dark:darken(@brand -secondary,15%); @ gray:#fff; @ gray-light:lighten(@gray,1%); @ gray-dark:darken(@ gray-light,10%); @ border-color:@gray -dark; @ highlight-success:#2ECC71; @ highlight-error:#E74C3C; @ highlight-notice:#F1C40F; @ highlight-info:#4AA3DF; @ body-bg:darken(@ gray-light,5%) ; @ text-color:@ brand-secondary; @ text-color-dark:@ brand-color:@ brand-primary; @ link-hover-color:darken(@ link-color,10 %); @ rating-star-color:@ highlight-notice; @ overlay-bg:#000000; @ overlay-opacity:0.7; @ font-base-stack:“Open Sans”,“Helvetica Neue”,Helvetica,Arial ,“Lucida Grande”,sans-serif; @ font-headline-stack:@ font-base-stack; @ font-size-base:14; @ font-base-重量:500; @ font-light-weight:300; @ font-bold-weight:700; @ font-size-h1:26; @ font-size-h2:21; @ font-size-h3:18; @ font-size-h4:16; @ font-size-h5:@ font-size-base; @ font-size-h6:12; @ btn-font-size:14; @ btn-icon-size:10; @ btn-default-top-bg:#FFFFFF; @ btn-default-bottom-bg:@ gray-light; @ btn-default-hover-bg:#FFFF
答案 0 :(得分:0)
我遇到了类似的问题,这是由Shopware默认将所有主题配置字段提交给LESS引起的。问题是没有实际字段添加到fieldset,所以当时Shopware没有正确处理这种情况,当前空字段集编译正常,但如果字段值与LESS不兼容,仍会出现类似错误。要排除字段添加到LESS,字段设置有lessCompatible
属性。例如:
$fieldSet->addElement(
$this->createMediaField(
'desktopLogo',
'__desktop__',
'frontend/_public/src/img/logos/logo--tablet.png',
['attributes' => ['lessCompatible' => false]]
)
);
这是来自Bare主题的Theme.php文件。似乎这个属性不能添加到fieldset默认值中,应该分别添加到每个字段中。