Jump to:

23545 Posts in 19310 Topics by 2888 members

General Questions

SilverStripe Forums » General Questions » Page Type Dropdown

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 2673 Views
  • JoshuaLewis
    Avatar
    Community Member
    76 Posts

    Page Type Dropdown Link to this post

    I have several questions :

    The names that appear in the option box when creating a new page are based on the class name. This creates a problem when names that would mean something to someone working in the CMS aren't so useful to a developer maintaining the code. I found one solution in an archived thread and was curious to hear if anyone has alternative/better solutions.
    http://silverstripe.org/archive/show/130387#post130387

    The ability to designate custom icons to be shown beside pages in the site tree is great for usability. This would be even better if those icons also showed up beside their respective page types in the dropdown box. Has this come up before and does anyone done it?
    Edit - http://open.silverstripe.org/ticket/4540

    Another usability issue is that there doesn't seem to be a way to organize items in the list. Any more than 5 or so custom page types and grouping can start to have a real benefit so does anyone know of a way to make this happen?
    Edit - http://open.silverstripe.com/ticket/4541

    Has anyone figured out how to control what page types are shown depending on what page is highlighted in the site tree? Going along with that idea, am I crazy to think that an $allowed_parent setting would be as useful as $allowed_children is?

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: Page Type Dropdown Link to this post

    The names that appear in the option box when creating a new page are based on the class name. This creates a problem when names that would mean something to someone working in the CMS aren't so useful to a developer maintaining the code. I found one solution in an archived thread and was curious to hear if anyone has alternative/better solutions.
    http://silverstripe.org/archive/show/130387#post130387

    Set the 'nice' name with:

    <?php
    class MyCrazyPageName extends Page {

       static $singular_name = "Nice Page";

       static $plural_name = "Nice Pages"

       ...

    The ability to designate custom icons to be shown beside pages in the site tree is great for usability. This would be even better if those icons also showed up beside their respective page types in the dropdown box. Has this come up before and does anyone done it?

    Don't think so, but bare in mind that this means you can't use a standard html select element. You would have to employ some sort of javascript select script, which means more overhead and a slower experience in general. Not a bad idea though. Worth looking at once the latest round of improvements (mostly javascript related) are complete.

    Another usability issue is that there doesn't seem to be a way to organize items in the list. Any more than 5 or so custom page types and grouping can start to have a real benefit so does anyone know of a way to make this happen?

    Good point. I'm not aware of a way, although you could name them as above so you get the sorting you want.

    Has anyone figured out how to control what page types are shown depending on what page is highlighted in the site tree? Going along with that idea, am I crazy to think that an $allowed_parent setting would be as useful as $allowed_children is?

    Hmm, that is getting into some quick fine-grained control.

    You should submit these are feature requests to the bug tracker at:

    http://open.silverstripe.com

  • JoshuaLewis
    Avatar
    Community Member
    76 Posts

    Re: Page Type Dropdown Link to this post

    Thanks Hamish. I'm surprised I haven't come across $singular_name and $plural_name before. After searching the documentation and forums for those specific names though I only found a handful of references, none of them very informative.

    I did some playing around earlier with placing icons and it can be done without javascript by setting them as background images using CSS. This would probably mean having the function creating the dropdown place the CSS as style attributes in the <option> elements.

    I'll look into submitting those tickets.

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Page Type Dropdown Link to this post

    @ Hamish:

    I can't remember where I read it, but aint static singular and plural name vars deprecated and shoudn't we use singular and pluralname in our language files?

    @JoshuaLewis :

    $allowed_children does limit the pagetypes in the dropdownmenu?

  • JoshuaLewis
    Avatar
    Community Member
    76 Posts

    Re: Page Type Dropdown Link to this post

    Martijn, that's true but there may be some cases where being able to write an $allowed_parent rule in one file would be more simple and easier to maintain than setting $allowed_children on everything else.

  • AlexBeka
    Avatar
    Community Member
    21 Posts

    Re: Page Type Dropdown Link to this post

    if someone is interested in having icons in the dropdown menu, just put the following code into cms/css/layout.css; but unfortunately the images are just shown in Firefox browser, not in IE, Chrome, Opera...; Testpage for styling single selection menu control options (option elements) with CSS

    #PageType option, #ClassName option {
       padding-left: 18px;
       height: 16px; /*height of tree icon files*/
    }
       #PageType option[value=Page], #ClassName option[value=Page] {
          background: url(../../jsparty/tree/images/page-file.gif) no-repeat;   
       }
       #PageType option[value=PageWithBanner], #ClassName option[value=PageWithBanner] {
          background: url(../../themes/dummytheme/images/treeicons/PageWithBanner-file.gif) no-repeat;   
       }
       #PageType option[value=RedirectorPage], #ClassName option[value=RedirectorPage] {
          background: url(../../cms/images/treeicons/page-shortcut-file.gif) no-repeat;   
       }
       #PageType option[value=VirtualPage], #ClassName option[value=VirtualPage] {
          background: url(../../cms/images/treeicons/page-shortcut-gold-file.gif) no-repeat;   
       }
       #PageType option[value=ErrorPage], #ClassName option[value=ErrorPage] {
          background: url(../../cms/images/treeicons/errorpage-file.gif) no-repeat;   
       }

    2673 Views
Page: 1
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.