Jump to:

10979 Posts in 2722 Topics by 1815 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: 7792 Views
  • Mo
    Avatar
    Community Member
    508 Posts

    New Module: Custom Menus Link to this post

    Hi All,

    Just thought I would announce that I am releasing a new module for your scrutinizing. Basically, it allows you to create custom navigation menus (such as "Header", "Footer" etc) and then link to these menu's from your template using <% control CustomMenu(menuslug) %>.

    Its still pretty basic, but lets you build a menu from a TreeMultiselectField, give that menu a slug and return a DataObjectSet of pages to your template when called.

    In the future I plan to add Versioning support, but any suggestions welcome .

    Download link: http://www.assembla.com/spaces/silverstripe-modules/documents/dQoxrEiiar37wFeJe5afGb
    Browse Source: http://www.assembla.com/code/silverstripe-modules/subversion/nodes/custommenus
    SVN Trunk: http://subversion.assembla.com/svn/ssmodules/custommenus/trunk

    I look forward to any feedback.

    Mo

    Edit Just noticed the svn link above isn't correct, have changed it now. Also, added direct link to SVN trunk.

    Edit Changed SVN link to proper link .

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: New Module: Custom Menus Link to this post

    I couldn't tortoiseSVN it, but pulled the zip and having a peak. Looks good - one little thing, it might be a good idea to change:

    <?php
    class CustomMenu extends Extension {
       public function CustomMenu($menu = null) {
          if($menu) {
             if(DataObject::get_one('CustomMenuHolder',"Slug = '$menu'")) {
             ...

    to

    <?php
    class CustomMenu extends Extension {
       public function CustomMenu($menu = null) {
          $menu = Convert::raw2sql($menu);
          if($menu) {
             if(DataObject::get_one('CustomMenuHolder',"Slug = '$menu'")) {
             ...

    I'm sure someone will create a menu slug like "John's Links" at some point.

  • Mo
    Avatar
    Community Member
    508 Posts

    Re: New Module: Custom Menus Link to this post

    Hi Hamish,

    Cheers for that, can't believe I didn't think of it, I must have been slacking off!

    I have added it to the trunk, what is the issue you are having with tortoise?

    Mo

  • cake
    Avatar
    Community Member
    19 Posts

    Re: New Module: Custom Menus Link to this post

    I think the correct URL for the svn checkout is:

    http://subversion.assembla.com/svn/ssmodules

    or

    http://subversion.assembla.com/svn/ssmodules/custommenu

    I will test your module now because this is exactly what i need ;-) Thanks for this nice little module!

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: New Module: Custom Menus Link to this post

    Hi Mo.

    I'm trying to use your module right now but I'm getting a javascript error saying $("Form_EditForm") is null on line 207 of LeftAndMain.js when I try to click on a newly created menu. This error also appears when loading the Menus area in SideTabs.js on line 64. I'm trying to run the module on version 2.3.5, is this 2.4 only?

  • cake
    Avatar
    Community Member
    19 Posts

    Re: New Module: Custom Menus Link to this post

    Yes, i can confirm this bug. You can workaround it if you call admin page with params like: /admin/menus/show/1
    But this doesn't solve the problem itself.

    I am really new to ss but i think there might have changed something in EditForm(). EditForm() returns if there is no result and it won't call getEditForm() in CustomMenuAdmin.

    But there's another issue. It pops up if you click the pages dropdown.

    404//I can't handle sub-URLs of a CustomMenuAdmin object. prototype.js?m=1226464322 Line 658

    Another one:

    There is missing a ?> at the end of _config.php

  • Mo
    Avatar
    Community Member
    508 Posts

    Re: New Module: Custom Menus Link to this post

    Hi Smurkas,

    Are you using the Zip file or an SVN Checkout from the trunk?

    Cake, what version of SS are you running on?

    Cheers for everyone's help on this so far, I am looking forward to making this module as usefall as it can be .

    Mo

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: New Module: Custom Menus Link to this post

    I did an SVN checkout. Should I use the zip file instead?

    7792 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.