Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » New Module: Custom Menus

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5 6 7
Go to End
Author Topic: 7681 Views
  • Mo
    Avatar
    Community Member
    504 Posts

    Re: New Module: Custom Menus Link to this post

    No probs juneallison,

    It is an interesting conundrum RE: centralising that info into one place. You could create a "Link" DataObject (or something similar) and use a has_one to associate it with a page. But you would probably have to use ModelAdmin to administer your new object, which probably end up taking just as much time to edit as it would being attached to a page.

    Logically, I think it makes more sense for this data to be part of your page object, rather than having to create new interfaces to try an manage it.

    What do you think?

    Mo

  • Olvis
    Avatar
    Community Member
    1 Post

    Re: New Module: Custom Menus Link to this post

    Hi there,

    I think "Custom Menus" is a great module. However, I also had problems with a multilingual site, when a client asked for the inclusion of multilingual support on a running site using "Custom Menus" with three different menus. Actually, I couldn't even get the menu items to show up in the frontend except those for the default locale, although the pages had content in all languages.

    I found a solution which might be considered ugly, but I had not much time or budget and it helped me out.

    I added this line to the Field() method in CustomMenuField.php on line 13:

    Translatable::disable_locale_filter();

    Now I could access all pages in all languages under the "Pages" tab and build different menus for the separate languages using a unique menu slug with the correct locale, e.g. "footer-menu-en_GB" or "footer-menu-de_DE".

    With a simple conditional logic I was now able to render the correct menu for the given language:

    <ul>
    <% if ContentLocale = de-DE %>
    <% control CustomMenu(footer-menu-de_DE) %>       
    <li><a href="$Link" class="$LinkingMode">$MenuTitle.XML</a></li>          
    <% end_control %>
    <% end_if %>
    <% if ContentLocale = en-GB %>
    <% control CustomMenu(footer-menu-en_GB) %>       
    <li><a href="$Link" class="$LinkingMode">$MenuTitle.XML</a></li>       
    <% end_control %>
    <% end_if %>
    </ul>

    Again, this is probably not the best solution, but it works perfectly and I could keep the old structure of my site. The only drawback is that you end up with a lot of pages under the pages tab. Maybe it would be nice to have a select-field for the languages as a filter.

    Hope that was helpful for someone else. In my case it saved my day.

  • juneallison
    Avatar
    Community Member
    108 Posts

    Re: New Module: Custom Menus Link to this post

    Mo -

    "Logically, I think it makes more sense for this data to be part of your page object, rather than having to create new interfaces to try and manage it. What do you think?"

    I agree. That is what I was getting at in my last message but you did a much better job of articulating the idea.

    Thanks!

  • Mo
    Avatar
    Community Member
    504 Posts

    Re: New Module: Custom Menus Link to this post

    Hi Olvis,

    Unfortunately, I very rarely need to produce multilingual sites, so I have been a bit unsure how to add this functionality.

    Is your suggestion that you would have normal generic menu's (say, for example: "Main Menu", "Footer Menu" etc) and that for each menu you would have the ability to assign pages from all languages to that menu independently?

    So, for example, you could have an English language version of a site with "about" and "services" assigned to a menu, but on (for example) a German version of that site, only the "about" page would be assigned?

    I think that could work quite nicely, and would also allow you to build independant regional sites (using the same core navigation and templates) quite easily in the CMS.

    Not sure how you would represent this in the UI though. You could use a dropdown to filter. But you could also have something like a tab for each language in your site.

    I think I will need to give it some thought and have a play around.

    Mo

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: New Module: Custom Menus Link to this post

    Having same problem as others i.e. when I edit a menu it's just default Page tabs displayed.

    I'm using a SS 2.4.5 and latest downloads fromt GitHub for DataObjects, Uploadify and CustomMenus.

    I actually think this may be related to SS or DataObjects, in that yesterday (on a separate new install) I started to work on creating a new Admin module (using the SS documentation examples), and whatever I did I could not get the tabs/fields for my module to display. So I remembered that I was going to install and test CustomMenus for another project and that too extended LeftandMain. So I was surprised to find the exact same problems as CustomMenus.

    So I'm thinking this is maybe bug in SS?

    Thanks

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: New Module: Custom Menus Link to this post

    Ok I must have missed the download you posted earlier for 0.2.5a - updating to that worked!

    Note: For my own Admin panel I was using http://doc.silverstripe.org/sapphire/en/reference/leftandmain as a guide and there is no mention of the need for the javascript you added to ensure EditForm displays. i.e. need to have extra javacript to get a customised right panel to display?

    PS As a result of this issue now had time to test CustomMenus - awsome work... can't think how useful this will be for lower level menus, especially being able to items from other levels or parts of the tree . Many thanks for you work on this

  • juneallison
    Avatar
    Community Member
    108 Posts

    Re: New Module: Custom Menus Link to this post

    @Mo - i don't know if this has been documented anywhere but when one of my site's admins went to delete a page the entire site (front-end) produced an error. Sorry I didn't write it down! But I want to say this was a result of deleting a page prior to removing it from the custom menu. Other pages - not found in the custom menu - have deleted without a problem. It seems like it would be nice if the user could receive a message something like "you must remove this from the custom menu" before deleting.

    I can test this out on a sandbox site later if you like.

    Thanks!

  • juneallison
    Avatar
    Community Member
    108 Posts

    Re: New Module: Custom Menus Link to this post

    @Mo - to comment on my previous problem: The error happened when a page was unchecked but the id had not been removed from the order list.

    I'm now having the opposite problem. I just checked a page I want to add and updated the menu. I went to the order page and it is not appearing there. So I don't know what the page ID number is that I need to add to the list.

    Any help would be great.

    Thanks!

    7681 Views
Page: 1 2 3 4 5 6 7
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.