Okay, now we're getting somewhere. Post your code for that entire page.. I don't need the dataobjects.. just the getCMSFields for your page.
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
attn uncle cheese - dataObjectManager bug?
- Previous 10 entries
- 1
- Page 22(current)
- 3
- 4
- Next 10 entries
class DesignDetailsPage extends Page {
...
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new DropdownField(
'ResponsibleOffice',
'Responsible office',
singleton('DesignDetailsPage')->dbObject('ResponsibleOffice')->enumValues()
),'Content');
$manager2 = new DataObjectManager(
$this, // Controller
'Characteristics', // Source name
'Characteristic', // Source class
array(
'Label' => 'Label',
'Value' => 'Value'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$fields->addFieldToTab('Root.Content.Characteristics', $manager2);
$fields->addFieldToTab("Root.Content.Factsheet", new FileIFrameField('Download1','Factsheet'));
$fields->addFieldToTab("Root.Content.Design drawing", new FileIFrameField('Download2','Design drawing'));
$manager3 = new DataObjectManager(
$this, // Controller
'References', // Source name
'Reference', // Source class
array(
'Name' => 'Name',
'Website' => 'Website',
'Category' => 'Category'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$fields->addFieldToTab('Root.Content.References', $manager3);
return $fields;
}
AND this code from page.php (I have set up one ImageDOM in page.php that I use on alle pages). As I'm writing this... this solution might be a trouble maker...
class Page extends SiteTree {
...
public function getCMSFields() {
$fields = parent::getCMSFields();
if(!Member::currentUser()->isAdmin()) {
$fields->removeByName("Behaviour");
$fields->removeByName("To-do");
$fields->removeByName("Reports");
$fields->removeByName("Google Sitemap");
$fields->removeByName("Navigation label");
}
$manager = new ImageDataObjectManager(
$this, // Controller
'Photos', // Source name
'Photo', // Source class
'Image',
array(), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$fields->addFieldToTab('Root.Content.Images', $manager);
$metadataTab = $fields->findOrMakeTab('Root.Content.Metadata');
$fields->removeByName('Metadata');
$fields->addFieldToTab('Root.Content', $metadataTab);
return $fields;
}
Can you check if activating drag-and-drop on the one that doesn't work actually enables drag-and-drop on one of the other two DOMs on the page?
Selecting checkboxe drag'n'drop on Characteristics and/or References doesn't change anything. Cursor changes into a hand, but when trying to drag only text is selected. The ImageDOM drag'n'drop works fine after acitvating drag'n'drop. I can't see any cross-tab behaviour.
Does it work when you remove the ImageDOM?
BTW, you're going to want a ->setParentClass('Page') on the ImageDOM if it's cascading down to subclasses. Otherwise it will barf when you pass it $this as a controller.
Yes! When I comment out the ImageDOM in page.php, drag'n'drop works again for Characteristics and References!
Alright, I'll try setting up concurrent instances of ImageDOM and DOM and see what happens.
Hi, I've the similar problem when I click on "Add Image" ( see this old post: http://www.silverstripe.org/archive/show/212710#post212710 ) , I've on PopUp Windows this error: "I can't handle sub-URLs of a CMSMain object."
class ImageAttachment extends DataObject {
static $db = array(
'Name' => 'Text'
);
static $has_one = array(
'Image' => 'Resize_Image',
'Product' => 'Product'
);
static $field_names = array('Name' => 'Name');
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('Name', 'Name'));
$fields->push(new ImageField('Image', 'Image'));
return $fields;
}
}
....
$imagetable = new ComplexTableField(
$this,
'ImageAttachments', // relation name
'ImageAttachment', // object class
ImageAttachment::$field_names, // fields to show in table
ImageAttachment::getCMSFields_forPopup(), // form that pops up for edit
"ProductID = {$this->ID}", // a filter to only display item associated with this page
"Name ASC" // Sort by name
);
$fields->addFieldToTab('Root.Content.Additional Images', $imagetable);
- Previous 10 entries
- 1
- Page 22(current)
- 3
- 4
- Next 10 entries