Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getTreeAction(Request $request): JsonResponse
'statusCode' => '200',
'status' => 'success',
'tree_type' => $assignation['tree_type'],
'folderTree' => $this->twig->render('@RoadizRozier/widgets/tree/rz_tree_wrapper_auto.html.twig', $assignation),
'folderTree' => $this->twig->render('@RoadizRozier/widgets/rz_tree_wrapper_auto.html.twig', $assignation),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function getTreeAction(Request $request): JsonResponse
'status' => 'success',
'tree_type' => $assignation['tree_type'],
'linkedTypes' => $linkedTypes,
'nodeTree' => trim($this->twig->render('@RoadizRozier/widgets/tree/rz_tree_wrapper_auto.html.twig', $assignation)),
'nodeTree' => trim($this->twig->render('@RoadizRozier/widgets/rz_tree_wrapper_auto.html.twig', $assignation)),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function getTreeAction(Request $request): JsonResponse
'statusCode' => '200',
'status' => 'success',
'tree_type' => $assignation['tree_type'],
'tagTree' => $this->twig->render('@RoadizRozier/widgets/tree/rz_tree_wrapper_auto.html.twig', $assignation),
'tagTree' => $this->twig->render('@RoadizRozier/widgets/rz_tree_wrapper_auto.html.twig', $assignation),
]);
}
}
12 changes: 8 additions & 4 deletions lib/RoadizRozierBundle/templates/macros/rz_page_header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,18 @@
'translationId': translation.id,
'locale': translation.locale
})) %}

{% set attr = { href: href } %}
{% if current == translation.getId %}
{% set attr = attr|merge({ 'aria-current': 'page' }) %}
{% endif %}

{{ rz_link.root({
class: class,
label: translation.preferredLocale,
attributes: {
href: href,
(current == translation.getId) ? aria-current: 'page' : null,
}
attributes: attr,
}) }}

{%- endfor -%}
{% if pathAddTranslations is defined and pathAddTranslations %}
{% set class = 'rz-button rz-button-group__button' %}
Expand Down
3 changes: 3 additions & 0 deletions lib/RoadizRozierBundle/templates/nodes/tree.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@
class="rz-tree"
group="nodeTree"
data-entity-type="node"
data-stack-tree="true"
data-is-sortable="{{ specificNodeTree.canReorder ? 'true' : 'false' }}"
id="children-stack-{{ specificNodeTree.id ?? node.id ?? 'root' }}"
>
{% include '@RoadizRozier/widgets/nodeTree/nodeTree.html.twig' with {
nodeTree: specificNodeTree,
node: specificNodeTree.getRootNode,
isMainTree: false,
layout: 'condensed',
} only %}
</rz-tree>
{% else %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{%- if folderTree -%}
<ul
class="rz-tree__list"
data-translation-id="{{ folderTree.translation.id }}"
{% if folder.getId %}data-parent-id="{{ folder.getId }}"{% endif %}
>
{% for cfolder in folderTree.folders %}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"isMainTree": isMainTree,
"level": 0,
'canReorder': nodeTree.canReorder,
"layout": layout,
} only %}
{% endfor %}
</ul>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
{% set innerClasses = innerClasses|merge(['rz-tree__item__node--not-visible']) %}
{% endif %}

<li
style="--rz-node-icon-background: {{ type.color }};"
data-entity-id="{{ node.id }}"
class="{{ classes|join(' ') }}"
{% if node.isHidingChildren %}data-hiding-children="true"{% endif %}
{% if not node.isVisible %}data-visible="false"{% endif %}
<li
style="--rz-node-icon-background: {{ type.color }};"
data-entity-id="{{ node.id }}"
class="{{ classes|join(' ') }}"
{% if node.isHidingChildren %}data-hiding-children="true"{% endif %}
{% if not node.isVisible %}data-visible="false"{% endif %}
>
<div
class="{{ innerClasses|join(' ') }}"
Expand All @@ -52,18 +52,20 @@
{% if type.isPublishable and source.publishedAt and source.publishedAt > date() %}
{% set icon_class = 'rz-icon-ri--history-line' %}
{% endif %}
{% set contextual_menu_id = 'node-contextual-menu-' ~ (isMainTree ? 'main-' : '') ~ node.id %}

{% embed '@RoadizRozier/widgets/rz_tree_item_inner.html.twig' with {
item: node,
has_children: children is defined and children|length > 0,
icon_class: icon_class,
can_reorder: canReorder and not node.isLocked,
has_selection: nodeTree.isStackTree,
has_selection: layout == 'condensed' and not isMainTree and nodeTree.isStackTree,
nodeTree: nodeTree,
isMainTree: isMainTree
isMainTree: isMainTree,
contextual_menu_id: contextual_menu_id,
} only %}
{% block icon_content %}
{%- if not isMainTree and not nodeTree.isStackTree -%}
{%- if layout == 'condensed' -%}
<rz-entity-thumbnail
class="nodetree-element-img rz-node-icon__thumbnail"
entity-class="RZ\Roadiz\CoreBundle\Entity\Node"
Expand Down Expand Up @@ -141,7 +143,6 @@


{% block contextual_menu %}
{% set contextual_id = 'node-contextual-menu-' ~ (isMainTree ? 'main-' : '') ~ item.id %}
<rz-node-tree-contextual-menu
class="rz-node-contextual-menu"
data-contextual-menu-path="{{ path('nodeContextualMenu', {
Expand All @@ -155,7 +156,7 @@
data-node-copied-trans="{{ 'node.copied_to_clipboard'|trans }}"
data-node-edit-position-path="{{ path('nodesPositionAjax') }}"
popover-placement="bottom-end"
id="{{ contextual_id }}"
id="{{ contextual_menu_id }}"
>
{% import '@RoadizRozier/macros/rz_button.html.twig' as rz_button %}
{{ rz_button.root({
Expand All @@ -165,7 +166,7 @@
class: 'tree-contextualmenu-button',
attributes: {
'aria-label': 'show.actions'|trans,
popovertarget: contextual_id ~ '-popover',
popovertarget: contextual_menu_id ~ '-popover',
type: 'button',
}
})}}
Expand Down Expand Up @@ -194,6 +195,7 @@
"level": level + 1,
'canReorder': (node.childrenOrder == 'position'),
'is_last': loop.last,
"layout": layout,
} only %}
{% endfor %}
</ul>
Expand Down
11 changes: 7 additions & 4 deletions lib/RoadizRozierBundle/templates/widgets/rz_aside.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<rz-aside class="rz-aside">
{% set default_translation = getAvailableTranslations()|find(t => t.defaultTranslation) %}
<rz-aside
class="rz-aside"
id="rz-aside"
data-default-translation-id="{{ default_translation.id }}"
>
<div class="rz-aside__body">
{% include '@RoadizRozier/widgets/tree/rz_tree_wrapper_auto.html.twig' with {
root_classes: ['rz-aside__body'],
} %}
{% include '@RoadizRozier/widgets/rz_tree_wrapper_auto.html.twig' only %}
</div>
</rz-aside>
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

<ul class="{{ classes|join(' ') }}" data-tree-type="{{ type_prefix }}">
{%- for translation in translations -%}
{{ _self.item(translation, tree) }}
{{ _self.item(translation, tree, btn_attr) }}
{%- endfor -%}
</ul>
{% endif %}


{% macro item(translation, tree) %}
{% macro item(translation, tree, btn_attr = {}) %}
<li class="rz-language-switcher__item">
{% set button_data = {
emphasis: 'tertiary',
Expand All @@ -21,7 +21,11 @@

{% if tree is defined %}
{% set button_data = button_data|merge({ selected: translation.id == tree.translation.id }) %}
{% set button_attr = { 'data-translation-id': translation.id } %}
{% set button_attr = {
'data-translation-id': translation.id,
'command': '--update-translation',
'type': 'button',
} %}

{% if tree.rootNode is defined %}
{% set button_attr = button_attr|merge({'data-children-parent-node': tree.rootNode.id }) %}
Expand All @@ -31,10 +35,12 @@
{% set button_attr = button_attr|merge({'data-filter-tag': tree.tag.id}) %}
{% endif %}

{% set button_data = button_data|merge({attributes: button_attr}) %}
{% endif %}

{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %}
{{ rz_button.root(button_data) }}
{{ rz_button.root(button_data|merge({
attributes: button_attr|merge(btn_attr)
}))
}}
Comment on lines 14 to 44
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In item(), button_attr is only defined inside {% if tree is defined %}, but it is later used unconditionally in button_attr|merge(btn_attr). If this macro is ever used without a tree argument, Twig will raise an undefined variable error. Initialize button_attr to {} before the if so the macro is safe.

Copilot uses AI. Check for mistakes.
</li>
{% endmacro %}
58 changes: 0 additions & 58 deletions lib/RoadizRozierBundle/templates/widgets/rz_tree_wrapper.html.twig

This file was deleted.

Loading
Loading