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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Error Missing Argument


Go to End


2 Posts   2019 Views

Avatar
pinkp

Community Member, 182 Posts

20 January 2010 at 12:44am

Edited: 20/01/2010 12:45am

I have this error when extending ImageGallery, I'm sure its something simple but I just can't work it out!! help appreciated, thanks
It happens when I try and add the pagetype in the CMS.

"ERROR [Warning]: Missing argument 1 for ImageGalleryPage::getCMSFields(), called in /home/sites/mysite.co.uk/public_html/mysite/code/MyImageGalleryPage.php on line 17 and defined
IN POST /admin/getitem?ID=20&ajax=1
Line 106 in /home/sites/mysite.co.uk/public_html/image_gallery/code/ImageGalleryPage.php"

I'm trying to add two image fields to my 'images' tab it worked in MAMP but not live...

This is my MyImageGallery.php

<?php
class MyImageGalleryPage extends ImageGalleryPage {
	
protected $itemClass = "MyImageGalleryItem";

static $icon = "themes/shop/images/treeicons/gallery";

static $db = array(
   );	

static $has_one = array(
	'GalleryButtonImage' => 'Image',
	'GalleryButtonImage2' => 'Image'
	);
   
   function getCMSFields(){
	  $f = parent::getCMSFields();
	  
      $f->addFieldToTab("Root.Content.Images", new ImageField('GalleryButtonImage','Button Image'));  
	  $f->addFieldToTab("Root.Content.Images", new ImageField('GalleryButtonImage2','Button Image Roll Over'));  
      return $f;
   }
} 

class MyImageGalleryPage_Controller extends ImageGalleryPage_Controller {

}
?>

Avatar
UncleCheese

Forum Moderator, 4102 Posts

20 January 2010 at 3:01am

Use getCMSFields($cms);