-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
- Winter CMS Build: 1.2.7
- Pages Plugin Version: 2.1.4
- PHP Version: 8.1 / 8.2 / 8.3
Description:
If there are static pages in the static menu (type Static page with Reference), these elements do not have set URL and so the links are not working, when Static menu component is attached to the layout. If there are custom URLs or CMS pages in the static menu - these are working fine, so the problem is only with Static page type of menu item.
Steps To Reproduce:
Scenario 1:
- Require winter/wn-pages-plugin plugin to clean Winter CMS installation
- Go to Pages section, create some static pages
- Go to Pages section, create a menu (eg. staticMenu) and add static pages from step 1. - for Type select "Static page" and select appropriate Reference in the dropdown
- Go to CMS section select Layouts and select default.htm and add component Pages / Static menu
- Display the component somewhere in the body: {% component 'staticMenu' %}
- Check the frontend - you will see, that the Static pages do not have "a href" attribute (probably because they don't have URLs)
Scenario 2:
- Repeat steps 1-4 from "Scenario 1"
- Add this code to the body:
{% for item in staticMenu.menuItems %} <li><a href="{{ item.url }}">{{ item.title }}</a></li> {% endfor %} - Check the frontend - you will see, that the "item.url" is empty if the Type is Static page