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

Staging content showing on published pages

Go to End

3 Posts   1906 Views

Aaron Brockhurst

Community Member, 30 Posts

1 October 2009 at 3:51am

Hi Uncle Cheese

I've found that content in the dataobjectmanager is showing on the published page when the page is in staging. For instance if I create a page and publish it, then make an edit, add some images through DOM and save the images are displayed on the published site.

Is there a way to hide the images?

My code is as follows:



class ImageBlock extends DataObject {
static $db = array(
'ImageBlockTitle' => 'Varchar',
'ImageBlockAltText' => 'Text',
'ImageBlockText' => 'HTMLText'

static $has_one = array(
//'ImageBlockLinkPage' => 'SiteTree',
'ImageBlockImage' => 'Image',
'ContentPage' => 'ContentPage',
'SectionPage' => 'SectionPage',
'HomePage' => 'HomePage'

public function getCMSFields_forPopup()
return new FieldSet(
new TextField('ImageBlockTitle','Enter the Title'),
new FileIFrameField('ImageBlockImage'),
new TextField('ImageBlockAltText','Enter the ALT (Roll over) text for the image')//,
//new TextField('ImageBlockText','Enter the link text'),
//new SimpleTreeDropdownField("ImageBlockLinkPageID", "Select the page to link", "SiteTree")



DOM code in Page.php

public static $has_many = array(
'PageImages' => 'ImageBlock',

function getCMSFields() {
$fields = parent::getCMSFields();
//Image Block
$ImageBlockmanager = new FileDataObjectManager(
$this, // Controller
'PageImages', // Source name
'ImageBlock', // Source class
'ImageBlockImage', // File name on DataObject
'ImageBlockTitle' => 'ImageBlockTitle',
'ImageBlockAltText' => 'ImageBlockAltText',
//'ImageBlockText' => 'ImageBlockText'
//'ImageBlockLinkPage' => 'ImageBlockLinkPage'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause

// If undefined, all types are allowed. Pass with or without a leading "."

// Label for the upload button in the popup
$ImageBlockmanager->setBrowseButtonText("Upload image (jpg or gif only)");

// In grid view, what field will appear underneath the icon. If left out, it defaults to the file title.

// Plural form of the objects being managed. Used on the "Add" button.
// If left out, this defaults to [MyObjectName]s
$ImageBlockmanager->setPluralTitle('Page Images');
return $fields;


Any suggestions?


Forum Moderator, 4102 Posts

1 October 2009 at 4:13am

Yeah, dataobjects don't have a live/published state AFAIK. If the client really wants it, usually i just add a "published" checkbox to my dataobject components.

Aaron Brockhurst

Community Member, 30 Posts

1 October 2009 at 4:15am

OK, Cool, that's a good idea