trans_title optional

This commit is contained in:
Oleg Lavrovsky 2017-07-03 17:47:56 +02:00
parent 4869a79b43
commit dd52f23d54

View file

@ -39,7 +39,8 @@ def top_menu(context, parent, calling_page=None):
menuitem.show_dropdown = has_menu_children(menuitem) menuitem.show_dropdown = has_menu_children(menuitem)
menuitem.active = (calling_page.url.startswith(menuitem.url) menuitem.active = (calling_page.url.startswith(menuitem.url)
if calling_page else False) if calling_page else False)
menuitem.title = menuitem.trans_title if 'trans_title' in menuitem:
menuitem.title = menuitem.trans_title
return { return {
'calling_page': calling_page, 'calling_page': calling_page,
'menuitems': menuitems, 'menuitems': menuitems,
@ -49,7 +50,8 @@ def top_menu(context, parent, calling_page=None):
def menuitems_children(parent): def menuitems_children(parent):
menuitems_children = parent.get_children().live().in_menu().specific() menuitems_children = parent.get_children().live().in_menu().specific()
for menuitem in menuitems_children: for menuitem in menuitems_children:
menuitem.title = menuitem.trans_title if 'trans_title' in menuitem:
menuitem.title = menuitem.trans_title
return menuitems_children return menuitems_children
# Retrieves the children of the top menu items for the drop downs # Retrieves the children of the top menu items for the drop downs