diff --git a/src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js b/src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js index ca36015107..3cf1ec9d33 100644 --- a/src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js +++ b/src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js @@ -6,7 +6,7 @@ } const header = doc.querySelector('.ibexa-edit-header'); - const headerContainer = header.querySelector('.ibexa-edit-header__container'); + const headerContainer = header?.querySelector('.ibexa-edit-header__container'); const SECTION_ADJUST_MARGIN_TOP = 20; const formContainerNode = doc.querySelector('.ibexa-edit-content'); const getSectionGroupActiveItems = () => { @@ -117,7 +117,7 @@ if (!firstSection.isSameNode(lastSection) && lastSection.offsetHeight) { const lastSectionHeight = lastSection.offsetHeight; - const headerHeight = headerContainer.offsetHeight; + const headerHeight = headerContainer?.offsetHeight; const contentColumnHeight = contentColumn.offsetHeight; const additionalContentHeight = contentContainer.offsetHeight - sectionGroup.offsetHeight; const valueToCorrectHeightDiff = headerHeight + SECTION_ADJUST_MARGIN_TOP + additionalContentHeight; @@ -136,9 +136,9 @@ formContainerNode.addEventListener('scroll', () => { let firstVisibleSection = currentlyVisibleSections.find((section) => { const { top, height } = section.getBoundingClientRect(); - const headerBottomContainerHeight = header.offsetHeight - headerContainer.offsetHeight; + const headerBottomContainerHeight = header.offsetHeight - headerContainer?.offsetHeight; - return top + height >= headerContainer.offsetHeight + headerBottomContainerHeight + SECTION_ADJUST_MARGIN_TOP; + return top + height >= headerContainer?.offsetHeight + headerBottomContainerHeight + SECTION_ADJUST_MARGIN_TOP; }); if (!firstVisibleSection) { diff --git a/src/bundle/Resources/views/themes/admin/ui/on_the_fly/create_on_the_fly.html.twig b/src/bundle/Resources/views/themes/admin/ui/on_the_fly/create_on_the_fly.html.twig index 94498f5858..c6fb10d30f 100644 --- a/src/bundle/Resources/views/themes/admin/ui/on_the_fly/create_on_the_fly.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/on_the_fly/create_on_the_fly.html.twig @@ -67,3 +67,31 @@ 'language': language }) }} {% endblock %} + +{% block anchor_menu %} + {% set content_edit_anchor_menu = knp_menu_get('ibexa.admin_ui.menu.content_edit.anchor_menu', [], { + content, + 'content_type': content_type, + 'location': location, + 'parent_location': parent_location, + 'language': language, + 'grouped_fields': grouped_fields, + }) %} + + {% embed '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params %} + {% block navigation_menu_body %} + {{ knp_menu_render(content_edit_anchor_menu, { 'template': '@ibexadesign/ui/menu/anchor_menu.html.twig' }) }} + {% endblock %} + {% endembed %} +{% endblock %} + +{% block content_sections %} + {{ ibexa_render_component_group('content-edit-sections', { + 'form': form, + 'content': content, + 'content_type': content_type, + 'location': location, + 'parent_location': parent_location, + 'language': language + }) }} +{% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/ui/on_the_fly/edit_on_the_fly.html.twig b/src/bundle/Resources/views/themes/admin/ui/on_the_fly/edit_on_the_fly.html.twig index fe229352f8..ed4ad9efe1 100644 --- a/src/bundle/Resources/views/themes/admin/ui/on_the_fly/edit_on_the_fly.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/on_the_fly/edit_on_the_fly.html.twig @@ -70,3 +70,31 @@ 'language': language }) }} {% endblock %} + +{% block anchor_menu %} + {% set content_edit_anchor_menu = knp_menu_get('ibexa.admin_ui.menu.content_edit.anchor_menu', [], { + 'content': content, + 'content_type': content_type, + 'location': location, + 'parent_location': parent_location, + 'language': language, + 'grouped_fields': grouped_fields, + }) %} + + {% embed '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params %} + {% block navigation_menu_body %} + {{ knp_menu_render(content_edit_anchor_menu, { 'template': '@ibexadesign/ui/menu/anchor_menu.html.twig' }) }} + {% endblock %} + {% endembed %} +{% endblock %} + +{% block content_sections %} + {{ ibexa_render_component_group('content-edit-sections', { + 'form': form, + 'content': content, + 'content_type': content_type, + 'location': location, + 'parent_location': parent_location, + 'language': language + }) }} +{% endblock %}