Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

LeftAndMain subclass templates


Go to End


3 Posts   1532 Views

Avatar
Dave L

Community Member, 60 Posts

23 October 2014 at 3:15pm

Edited: 23/10/2014 3:16pm

I'm working through the examples at http://doc.silverstripe.org/framework/en/reference/cms-architecture. So far I have a MyAdmin class and I have MyAdmin_Content.ss, MyAdmin_Tools.ss and MyAdmin_EditForm.ss displaying. However, when I click to another section of the CMS, e.g. Pages. My screen doesn't redraw and the MyAdmin templates remain. Is there some addtional markup or JavaScript required beyond the LeftAndMain class and the MyAdmin_*.ss templates?

MyAdmin.php:

class MyAdmin extends LeftAndMain {

    static $url_segment = 'myadmin';
    static $url_rule = '$Action/$ID';
    static $menu_title = 'My Admin';
    static $menu_priority = 60;
   public function getEditForm($id = null, $fields = null) {
        $fields = new FieldList(new ReadonlyField('id #', $id));
        $actions = new FieldList(new FormAction('go'));
        return new Form($this, "EditForm", $fields, $actions);
    }

}

MyAdmin_Content.ss:

<div class="cms-content center ss-tabset" data-layout-type="border">
    <div class="cms-content-header north">
        <div class="cms-content-header-info">
            Some header stuff
        </div>
    </div>

    $Tools

    <div class="cms-content-fields center ui-widget-content" data-layout-type="border">
        $EditForm
    </div>
</div>

Avatar
Devlin

Community Member, 344 Posts

23 October 2014 at 8:40pm

Edited: 23/10/2014 8:41pm

I had the same problem and I fixed by adding data-pjax-fragment="Content" to the .cms-content tag.

<div class="cms-content cms-tabset center $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">

See my module Manifest Inspector. It's a rather unorthodox but simple extension for LeftAndMain.

https://github.com/JayDevlin/silverstripe-module-manifest-inspector

Avatar
Dave L

Community Member, 60 Posts

23 October 2014 at 8:51pm

Awesome, that's done it thanks.