3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 848 Views |
-
3 fields "Image" on the page

11 December 2009 at 12:04pm
I need to set up 3 fields "Image" for my template.
I'm writing like this:
static $has_many = array(
"Image" => "Image",
"Image2" => "Image",
"Image3" => "Image"
);public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new ImageField("Image"), "Content");
$fields->addFieldToTab("Root.Content.Bucket1", new ImageField("Image2"), "Content");
$fields->addFieldToTab("Root.Content.Bucket2", new ImageField("Image3"), "Content");
return $fields;
}But the fields does not appear on the tabs "Bucket1" and "Bucket2".
Can you please help me with that?
-
Re: 3 fields "Image" on the page

11 December 2009 at 7:56pm
static $has_many = array( ..
A Page doesn't have 3 has_many images, Rather it should have them as a one to many rather then a many to many. So change that to
static $has_one = array(..
The image fields on the other BucketTabs are probably not showing due to the fact you are saying in your addFieldToTab to put them BEFORE a field called 'Content'. This 'Content' Field doesn't exist on the Bucket1, Bucket2 tabs so its not added. Try changing those lines to
$fields->addFieldToTab("Root.Content.Bucket1", new ImageField("Image2"));
$fields->addFieldToTab("Root.Content.Bucket2", new ImageField("Image3"));
| 848 Views | ||
|
Page:
1
|
Go to Top |


