[英]OroPlatform: override Oro bundle template
I'm trying to override the following template: vendor/oro/platform/src/Oro/Bundle/OrganizationBundle/Resources/views/BusinessUnit/update.html.twig
我正在尝试覆盖以下模板:
vendor/oro/platform/src/Oro/Bundle/OrganizationBundle/Resources/views/BusinessUnit/update.html.twig
This template seems to belong to the OroOrganizationBundle
bundle.此模板似乎属于
OroOrganizationBundle
捆绑包。
So, I have tried to put my override in the following path: templates/bundles/OroOrganizationBundle/BusinessUnit/update.html.twig
according to Symfony 4.X documentation: https://symfony.com/doc/4.4/bundles/override.html#templates So, I have tried to put my override in the following path:
templates/bundles/OroOrganizationBundle/BusinessUnit/update.html.twig
according to Symfony 4.X documentation: https://symfony.com/doc/4.4/bundles/override .html#模板
I have cleared the cache: symfony console cache:clear
but nothing changes.我已清除缓存:
symfony console cache:clear
但没有任何变化。
Here is my override template:这是我的覆盖模板:
{% extends 'OroOrganizationBundle:BusinessUnit:update.html.twig' %}
{% block content_data %}
{% set id = 'business_unit-profile' %}
{% set dataBlocks = [{
'title': 'General'|trans,
'class': 'active',
'subblocks': [{
'title': '',
'data': [
form_widget(form.appendUsers, {'id': 'businessUnitAppendUsers'}),
form_widget(form.removeUsers, {'id': 'businessUnitRemoveUsers'}),
form_row(form.name),
form_row(form.parentBusinessUnit),
form_row(form.phone),
form_row(form.website),
form_row(form.email),
form_row(form.fax),
]
}]
}] %}
{% set dataBlocks = dataBlocks|merge(oro_form_additional_data(form, 'Additional Override'|trans)) %}
{% set dataBlocks = dataBlocks|merge([{
'title' : 'oro.organization.businessunit.users.label'|trans,
'subblocks': [{
'title' : null,
'useSpan': false,
'data' : [dataGrid.renderGrid(gridName, {business_unit_id: entityId}, { cssClass: 'inner-grid' })]
}]
}] ) %}
{% set data = {
'formErrors': form_errors(form)? form_errors(form) : null,
'dataBlocks': dataBlocks
} %}
{{ parent() }}
{% endblock content_data %}
Here is the output of the following command line: symfony console debug:twig | grep Organization
这是以下命令行的output:
symfony console debug:twig | grep Organization
symfony console debug:twig | grep Organization
Finally, I found a solution using this article from Oro documentation: https://doc.oroinc.com/frontend/back-office/templates/最后,我使用 Oro 文档中的这篇文章找到了解决方案: https://doc.oroinc.com/frontend/back-office/templates/
The right path for my case was: src/Resources/OroOrganizationBundle/views/BusinessUnit/update.html.twig
我的案例的正确路径是:
src/Resources/OroOrganizationBundle/views/BusinessUnit/update.html.twig
I have tried to use the "extends" method from the Symfony documentation: https://symfony.com/doc/4.4/bundles/override.html#templates which consist to override only a specific block part.我尝试使用 Symfony 文档中的“扩展”方法: https://symfony.com/doc/4.4/bundles/override.html#templates仅覆盖特定的块部分。 In my case, I needed to copy the entire file but it works.
就我而言,我需要复制整个文件,但它可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.