Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » SS3: CMS Admin Header is displayed twice

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

Page: 1
Go to End
Author Topic: 399 Views
  • juergr
    Avatar
    Community Member
    17 Posts

    SS3: CMS Admin Header is displayed twice Link to this post

    OK, let's go straight to the problem...

    I have a page with this code (simplified):

    class AreaHolder extends Page {
    static $has_many = array(
    'Areas' => 'Area'
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $grid_Config = GridFieldConfig_RecordEditor::create();
    $grid_Config->getComponentByType('GridFieldDataColumns')
    ->setDisplayFields(array(
    'Title' => 'Name',
    'RouteCount' => 'Anzahl Routen'
    ));

    $fields->addFieldToTab('Root.Klettergebiete',
    new GridField('Klettergebiete', 'Klettergebiete', $this->Areas(), $grid_Config));
    return $fields;
    }
    }

    class AreaHolder_Controller extends Page_Controller {
    }

    And the Area DataObject which looks like this (simplified):

    class Area extends DataObject {
    static $db = array(
    'Title' => 'Varchar(255)'
    );

    static $has_one = array(
    'Page' => 'AreaHolder'
    );

    static $has_many = array(
    'Sectors' => 'Sector',
    'SinglePitches' => 'SinglePitch',
    'MultiPitches' => 'MultiPitch'
    );

    function getRouteCount() {
    return $this->SinglePitches()->Count() + $this->MultiPitches()->Count();
    }

    function getCMSFields() {

    $fields = new FieldList(
    new TabSet('Root',
    new Tab('Main', 'Hauptteil'),
    new Tab('SinglePitch', 'Einseillängen'),
    new Tab('MultiPitch', 'Mehrseillängen')
    ));

    $fields->addFieldToTab('Root.Main', new TextField('Title', 'Name', $this->Title));
    $fields->addFieldToTab('Root.Main', new GridField('Sectors','Sektoren', $this->Sectors(), GridFieldConfig_RecordEditor::create();));
    $fields->addFieldToTab('Root.SinglePitch', new GridField('SinglePitches', 'Einseillängenrouten', $this->SinglePitches(), GridFieldConfig_RecordEditor::create();));
    $fields->addFieldToTab('Root.MultiPitch', new GridField('MultiPitches', 'Mehrseillängenrouten', $this->MultiPitches(), GridFieldConfig_RecordEditor::create();));
    return $fields;
    }
    }

    In the attached images you can see that the Header of the CMS Admin gets duplicated as soon as i want to edit one item from the gridfield or create a new one. Editing/Creating works fine, but a click on the back button or one of the links in the Breadcrumb breaks the Admin Interface and the whole right part is just blank.

    If added another picture "AreaAfterRefresh" which shows (in my opinion) the correct Header. This Header is displayed if i reload the page with [F5] to my browser. After that, the back button and the links are working fine.

    What am I doing wrong? Or is this a Bug?

    Attached Files
  • juergr
    Avatar
    Community Member
    17 Posts

    Re: SS3: CMS Admin Header is displayed twice Link to this post

    I still have no solution for this. is out there someone with the same problem?

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