Hi,
I was justing try to use the setPageSize() method and it doesn't seem to be working. I can get to it work by changing the line
protected $per_page = "5";
Cheers
Robin
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
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.
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
Hi,
I was justing try to use the setPageSize() method and it doesn't seem to be working. I can get to it work by changing the line
protected $per_page = "5";
Cheers
Robin
That's because the page size is set in the UI in the bottom right. By changing the property per_page, you're setting the default value to that dropdown.
Hi, dataobject_manager is working out great for a current site, but I need to have images resized on upload (2 sizes: thumbnail and larger). I've read through the general GD and upload stuff but can't get my head around where the functions would sit....I've got this in TreeImage.php (TreeImages are pictures of trees:)
class TreeImage extends DataObject
{
static $db = array (
'TreeImageCaption' => 'Text',
);
static $has_one = array (
'TreeImageFile' => 'Image',
'TreePage' => 'TreePage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('TreeImageCaption'),
new ImageField('TreeImageFile')
);
}
}
so, I want to do something like:
function generateTreeThumb($gd) {
$gd->setQuality(100);
return $gd->croppedResize(240,180);
}
function generateTreeLarger($gd) {
$gd->setQuality(100);
return $gd->croppedResize(600,450);
}
but I'm not sure where it should sit....any helpful hints?? cheers
Hello
yesterday i installed the DataObjectManager.
BUt the Drag and Drop Function doesn't work.
And second Question.
I Have a Tablefield "Status" which is defined by 0 (offline) or 1 (online).
Now i have the Table with Status on top but with 1 or nothing in the fields.
How can i set online and offline there?
My current Code:
[bold]
function getCMSFields() {
$fields = parent::getCMSFields();
//related links tab
$manager = new DataObjectManager(
$this,
'LocationSubmissions',
'LocationSubmission',
array('Name' => 'Name','PLZ'=>'PLZ', 'Location' => 'Ort', 'Status' => 'Status'),
'getCMSFields_forPopup'
);
$manager->setFilter('Status','Nach Status sortieren',array(
'1' => 'online',
'0' => 'offline'
));
$fields->addFieldtoTab("Root.Content.Locationsubmission",$manager);
return $fields;
}
[/bold]
Thanky you all!
@Breastfed: in your mysite/_config.php add the line:
SortableDataObject::add_sortable_class('LocationSubmission');
That will get the drag and drop sorting working.
As for the status, EDIT...
Add this code to your LocationSubmission
public function getStatusField()
{
$value = $this->Status;
if($value) return "Online";
else return "Offline";
}
$manager = new DataObjectManager(
$this,
'LocationSubmissions',
'LocationSubmission',
array('Name' => 'Name','PLZ'=>'PLZ', 'Location' => 'Ort', 'Status''getStatusField' => 'Status'),
'getCMSFields_forPopup'
);
UncleCheese: Is there a way to make the upload directory be assets/[pagename]
I see that you can let the user specify the directory, but I want to force it to be a sub directory of assets based on the name of the page.
@ drye -- Thank you for pitching in on support. It's nice to have gotten to a point with this thing where the whole thing isn't just on my shoulders anymore. To change the upload folder, use the allowUploadFolderSelection() method.
A reminder to everyone -- there is extensive documentation on DataObjectManager and all of its counterparts in the SS wiki. Please refer your questions there before simply saying something nondescript like "it doesn't work." I get dozens of support questions and feature requests every day, and it's very time consuming to go back and forth trying to get details. It is my goal to get this thing rock-solid and bug-free, so I appreciate any bug reports, but just make sure you all are doing your part and being as specific as possible and checking the documentation first.
Thanks for understanding.
We really appreciate the modules you've authored and the quality of support you give, Uncle Cheese. Thank you.