Akeneo类别树UI区域设置覆盖

时间:2018-07-12 00:06:41

标签: akeneo

我有一个在10种语言环境下运行的Akeneo 2.3。其中一种语言环境是我们自定义的语言环境,称为ab_AB。

binder .forField( this.phaseField ) .withConverter( new StringToIntegerConverter( "Must enter an integer number" ) ) .bind( Panel::getPhase , Panel::setPhase ) ; UI中查看类别树或将产品分配给类别UI时,将根据登录用户的语言环境显示类别的标签。

我想从ab_AB语言环境而不是已登录用户的语言环境中显示类别的标签值。

我已经研究了Settings -> Categories,以获取有关扩展/覆盖内容的提示,但不太确定该怎么做。

1 个答案:

答案 0 :(得分:2)

总结一下会发生什么:通过调用CategoryTreeController::childrenAction生成树。 rendered twig view将使用CategoryExtension中定义的Twig函数#contextMenu { position: absolute; display: none; } 格式化类别。

要设置自己的语言环境,您需要在项目中覆盖此扩展名(扩展类并重新定义类参数children_response)并覆盖受保护的方法getLabel,如下所示:

pim_enrich.twig.category_extension.class

当我的PIM是英语时,我已经成功地使用语言环境protected function getLabel( CategoryInterface $category, $withCount = false, $includeSub = false, $relatedEntity = 'product' ) { $category->setLocale('ab_AB'); return parent::getLabel($category, $withCount, $includeSub, $relatedEntity); } 对其进行了测试。然后,在fr_FR菜单和产品网格的类别过滤器中,类别标签都使用法语。

相关问题