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.

Customising the CMS /

[Warning] Illegal offset type in CMS


Reply


7 Posts   647 Views

Avatar
djpmedia

Community Member, 8 Posts

19 February 2014 at 6:29am

Hi,

Since the last time I added a new Dataobject I get the following error in the CMS:

[Warning] Illegal offset type
GET /admin/pages/

Line 570 in /*/framework/view/Requirements.php

This error results in that it's not possible to create new pages.

Attached Files
Avatar
thomas.paulson

Community Member, 84 Posts

19 February 2014 at 3:11pm

change the environment to dev

http://doc.silverstripe.com/framework/en/topics/debugging

will help to fix the error

Avatar
djpmedia

Community Member, 8 Posts

19 February 2014 at 8:17pm

I've changed it to DEV mode and then I get the following error:

[Warning] Illegal offset type
GET /admin/pages

Line 570 in /*/framework/view/Requirements.php

Source

561
562    /**
563     * Register the given stylesheet file as required.
564     *
565     * @param $file String Filenames should be relative to the base, eg, 'framework/javascript/tree/tree.css'
566     * @param $media String Comma-separated list of media-types (e.g. "screen,projector")
567     * @see http://www.w3.org/TR/REC-CSS2/media.html
568     */
569    public function css($file, $media = null) {
570       $this->css[$file] = array(
571          "media" => $media
572       );
573    }
574
575    public function get_css() {
576       return array_diff_key($this->css, $this->blocked);
Trace

Requirements_Backend->css(Array,)
Requirements.php:142
Requirements::css(Array,)
LeftAndMain.php:411
LeftAndMain->init()
CMSMain.php:57
CMSMain->init()
Controller.php:139
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:438
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:89
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:325
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:143
Director::direct(/admin/pages,DataModel)
main.php:189

Attached Files
Avatar
thomas.paulson

Community Member, 84 Posts

20 February 2014 at 5:24pm

Do you want posting the DataObject you create, here?

Avatar
djpmedia

Community Member, 8 Posts

20 February 2014 at 9:00pm

This is my DataObject:

RendementTool.php:

<?php
class RendementTool extends Page {

    private static $db = array(
'RichtingPlatOno' => 'Varchar',
       'RichtingPlatOost' => 'Varchar',
'RichtingPlatOzo' => 'Varchar',
       'RichtingPlatZo' => 'Varchar',
       'RichtingPlatZzo' => 'Varchar',
'RichtingPlatZuid' => 'Varchar',
       'RichtingPlatZzw' => 'Varchar',
       'RichtingPlatZw' => 'Varchar',
       'RichtingPlatWzw' => 'Varchar',
       'RichtingPlatWest' => 'Varchar',
       'RichtingPlatWnw' => 'Varchar',
'RichtingSchuinAOno' => 'Varchar',
       'RichtingSchuinAOost' => 'Varchar',
'RichtingSchuinAOzo' => 'Varchar',
       'RichtingSchuinAZo' => 'Varchar',
       'RichtingSchuinAZzo' => 'Varchar',
'RichtingSchuinAZuid' => 'Varchar',
       'RichtingSchuinAZzw' => 'Varchar',
       'RichtingSchuinAZw' => 'Varchar',
       'RichtingSchuinAWzw' => 'Varchar',
       'RichtingSchuinAWest' => 'Varchar',
       'RichtingSchuinAWnw' => 'Varchar',
       'RichtingSchuinBOno' => 'Varchar',
       'RichtingSchuinBOost' => 'Varchar',
'RichtingSchuinBOzo' => 'Varchar',
       'RichtingSchuinBZo' => 'Varchar',
       'RichtingSchuinBZzo' => 'Varchar',
'RichtingSchuinBZuid' => 'Varchar',
       'RichtingSchuinBZzw' => 'Varchar',
       'RichtingSchuinBZw' => 'Varchar',
       'RichtingSchuinBWzw' => 'Varchar',
       'RichtingSchuinBWest' => 'Varchar',
       'RichtingSchuinBWnw' => 'Varchar',   
       'RichtingSchuinCOno' => 'Varchar',
       'RichtingSchuinCOost' => 'Varchar',
'RichtingSchuinCOzo' => 'Varchar',
       'RichtingSchuinCZo' => 'Varchar',
       'RichtingSchuinCZzo' => 'Varchar',
'RichtingSchuinCZuid' => 'Varchar',
       'RichtingSchuinCZzw' => 'Varchar',
       'RichtingSchuinCZw' => 'Varchar',
       'RichtingSchuinCWzw' => 'Varchar',
       'RichtingSchuinCWest' => 'Varchar',
       'RichtingSchuinCWnw' => 'Varchar',
       'RichtingSchuinDOno' => 'Varchar',
       'RichtingSchuinDOost' => 'Varchar',
'RichtingSchuinDOzo' => 'Varchar',
       'RichtingSchuinDZo' => 'Varchar',
       'RichtingSchuinDZzo' => 'Varchar',
'RichtingSchuinDZuid' => 'Varchar',
       'RichtingSchuinDZzw' => 'Varchar',
       'RichtingSchuinDZw' => 'Varchar',
       'RichtingSchuinDWzw' => 'Varchar',
       'RichtingSchuinDWest' => 'Varchar',
       'RichtingSchuinDWnw' => 'Varchar',
       'RichtingSchuinEOno' => 'Varchar',
       'RichtingSchuinEOost' => 'Varchar',
'RichtingSchuinEOzo' => 'Varchar',
       'RichtingSchuinEZo' => 'Varchar',
       'RichtingSchuinEZzo' => 'Varchar',
'RichtingSchuinEZuid' => 'Varchar',
       'RichtingSchuinEZzw' => 'Varchar',
       'RichtingSchuinEZw' => 'Varchar',
       'RichtingSchuinEWzw' => 'Varchar',
       'RichtingSchuinEWest' => 'Varchar',
       'RichtingSchuinEWnw' => 'Varchar'      
);
   
   private static $has_many = array(
'RendementToolPaneels' => 'RendementToolPaneel'
);

public function getCMSFields() {
$fields = parent::getCMSFields();
         $config = new GridFieldConfig_RelationEditor;
         $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Name' => 'Name'));
         $PanelenField = new GridField(
            'Panelen', // Field name
            'Panelen', // Field title
            $this->RendementToolPaneels(), // List of all related students
            $config
         );
$fields->addFieldToTab('Root.Panelen', $PanelenField);
       $fields->addFieldToTab('Root.Instellingen', new HeaderField("Platdak"));
       $fields->addFieldToTab('Root.Instellingen',
                   new FieldGroup(
      new TextField('RichtingPlatOno', 'ONO', '', '5'),
      new TextField('RichtingPlatOost', 'Oost', '', '5'),
                     new TextField('RichtingPlatOzo', 'OZO', '', '5'),
                     new TextField('RichtingPlatZo', 'ZO', '', '5'),
                     new TextField('RichtingPlatZzo', 'ZZO', '', '5'),
                     new TextField('RichtingPlatZuid', 'Zuid', '', '5'),
                     new TextField('RichtingPlatZzw', 'ZZW', '', '5'),
                     new TextField('RichtingPlatZw', 'ZW', '', '5'),
                     new TextField('RichtingPlatWzw', 'WZW', '', '5'),
                     new TextField('RichtingPlatWest', 'West', '', '5'),
                     new TextField('RichtingPlatWnw', 'WNW', '', '5')
));
      $fields->addFieldToTab("Root.Instellingen", new HeaderField("Schuindak 0-10 graden"));
       $fields->addFieldToTab('Root.Instellingen', new FieldGroup(
new TextField('RichtingSchuinAOno', 'ONO', '', '5'),
new TextField('RichtingSchuinAOost', 'Oost', '', '5'),
                   new TextField('RichtingSchuinAOzo', 'OZO', '', '5'),
                   new TextField('RichtingSchuinAZo', 'ZO', '', '5'),
                   new TextField('RichtingSchuinAZzo', 'ZZO', '', '5'),
                   new TextField('RichtingSchuinAZuid', 'Zuid', '', '5'),
                   new TextField('RichtingSchuinAZzw', 'ZZW', '', '5'),
                   new TextField('RichtingSchuinAZw', 'ZW', '', '5'),
                   new TextField('RichtingSchuinAWzw', 'WZW', '', '5'),
                   new TextField('RichtingSchuinAWest', 'West', '', '5'),
                   new TextField('RichtingSchuinAWnw', 'WNW', '', '5')   
));
       $fields->addFieldToTab("Root.Instellingen", new HeaderField("Schuindak 10-30 graden"));
       $fields->addFieldToTab('Root.Instellingen', new FieldGroup(
new TextField('RichtingSchuinBOno', 'ONO', '', '5'),
new TextField('RichtingSchuinBOost', 'Oost', '', '5'),
                   new TextField('RichtingSchuinBOzo', 'OZO', '', '5'),
                   new TextField('RichtingSchuinBZo', 'ZO', '', '5'),
                   new TextField('RichtingSchuinBZzo', 'ZZO', '', '5'),
                   new TextField('RichtingSchuinBZuid', 'Zuid', '', '5'),
                   new TextField('RichtingSchuinBZzw', 'ZZW', '', '5'),
                   new TextField('RichtingSchuinBZw', 'ZW', '', '5'),
                   new TextField('RichtingSchuinBWzw', 'WZW', '', '5'),
                   new TextField('RichtingSchuinBWest', 'West', '', '5'),
                   new TextField('RichtingSchuinBWnw', 'WNW', '', '5')   
));
         $fields->addFieldToTab("Root.Instellingen", new HeaderField("Schuindak 30-50 graden"));
          $fields->addFieldToTab('Root.Instellingen', new FieldGroup(
new TextField('RichtingSchuinCOno', 'ONO', '', '5'),
new TextField('RichtingSchuinCOost', 'Oost', '', '5'),
                   new TextField('RichtingSchuinCOzo', 'OZO', '', '5'),
                   new TextField('RichtingSchuinCZo', 'ZO', '', '5'),
                   new TextField('RichtingSchuinCZzo', 'ZZO', '', '5'),
                   new TextField('RichtingSchuinCZuid', 'Zuid', '', '5'),
                   new TextField('RichtingSchuinCZzw', 'ZZW', '', '5'),
                   new TextField('RichtingSchuinCZw', 'ZW', '', '5'),
                   new TextField('RichtingSchuinCWzw', 'WZW', '', '5'),
                   new TextField('RichtingSchuinCWest', 'West', '', '5'),
                   new TextField('RichtingSchuinCWnw', 'WNW', '', '5')
));
         $fields->addFieldToTab("Root.Instellingen", new HeaderField("Schuindak 50-70 graden"));
          $fields->addFieldToTab('Root.Instellingen', new FieldGroup(
new TextField('RichtingSchuinDOno', 'ONO', '', '5'),
new TextField('RichtingSchuinDOost', 'Oost', '', '5'),
                   new TextField('RichtingSchuinDOzo', 'OZO', '', '5'),
                   new TextField('RichtingSchuinDZo', 'ZO', '', '5'),
                   new TextField('RichtingSchuinDZzo', 'ZZO', '', '5'),
                   new TextField('RichtingSchuinDZuid', 'Zuid', '', '5'),
                   new TextField('RichtingSchuinDZzw', 'ZZW', '', '5'),
                   new TextField('RichtingSchuinDZw', 'ZW', '', '5'),
                   new TextField('RichtingSchuinDWzw', 'WZW', '', '5'),
                   new TextField('RichtingSchuinDWest', 'West', '', '5'),
                   new TextField('RichtingSchuinDWnw', 'WNW', '', '5')   
));
         $fields->addFieldToTab("Root.Instellingen", new HeaderField("Schuindak 70-90 graden"));
          $fields->addFieldToTab('Root.Instellingen', new FieldGroup(
new TextField('RichtingSchuinEOno', 'ONO', '', '5'),
new TextField('RichtingSchuinEOost', 'Oost', '', '5'),
                   new TextField('RichtingSchuinEOzo', 'OZO', '', '5'),
                   new TextField('RichtingSchuinEZo', 'ZO', '', '5'),
                   new TextField('RichtingSchuinEZzo', 'ZZO', '', '5'),
                   new TextField('RichtingSchuinEZuid', 'Zuid', '', '5'),
                   new TextField('RichtingSchuinEZzw', 'ZZW', '', '5'),
                   new TextField('RichtingSchuinEZw', 'ZW', '', '5'),
                   new TextField('RichtingSchuinEWzw', 'WZW', '', '5'),
                   new TextField('RichtingSchuinEWest', 'West', '', '5'),
                   new TextField('RichtingSchuinEWnw', 'WNW', '', '5')   
));
return $fields;
}
}

class RendementTool_Controller extends Page_Controller {
   private static $allowed_actions = array('OfferForm');
   
   function OfferForm()
      {
      return new OfferForm($this,'OfferForm');
      }
   
}

RendementToolPaneel.php

<?php
class RendementToolPaneel extends DataObject {

    private static $db = array(
"Name" => "Varchar",
"PaneelType" => "Enum(array('Poly kristallijn', 'Mono Full-Black', 'Thinfilm Glas', 'Mono kristallijn', 'CIS techniek', 'High efficiënt'))",
       "PaneelWatt" => "Int",
       "PaneelAfmeting" => "Varchar",
       "PaneelAfwijking" => "Int",
);
   
   private static $has_one = array(
'RendementTool' => 'RendementTool',
       'Photo' => 'Image'
);
      private static $has_many = array(
'RendementToolPaneelPrices' => 'RendementToolPaneelPrice',
);

public function getCMSFields() {
$fields = parent::getCMSFields();
      
return $fields;
}
}

Avatar
kinglozzer

Community Member, 171 Posts

20 February 2014 at 10:33pm

Can't be sure, but it looks like you've set up your 'extra_requirements_css' for LeftAndMain incorrectly. Is this something you've done somewhere (in config.yml or _config.php) or a perhaps a module you've installed?

Loz

Avatar
djpmedia

Community Member, 8 Posts

20 February 2014 at 11:33pm

Hi Loz,

Thanks that was te problem. The path to the 'extra_requirements_css' was incorrect. I've fixed this and now the error is gone.

Dennis