17488 Posts in 4473 Topics by 1978 members
| Go to End | ||
| Author | Topic: | 6451 Views |
-
Re: has_many editor

27 September 2007 at 3:42am
> 1) Is it easy to get rid of the checkboxes (as I am filtering the source they are always checked)? Maybe subclass and override the function?
other way around, use the parentclass ComplexTableField instead if you don't need the relation-setting through checkboxes
> 2) I'd like to show values from the Image class in the table somehow (e.g. filename).
you can show any properties that can be accessed on the normal object (or more with setCustomQuery())> 3) The ImageField control seems to require that the record is added before the image can be selected. This is a pain because you have to add a PortfolioImage and then edit it to choose an image.
thats by design, nothing you can easily change without rebuilding the ImageField, as its using iframes for upload. i agree that usability could be better in this use-case... -
Re: has_many editor

25 November 2007 at 4:05am
Hi Jam,
Did you get these things fixed in the meantime ? Working on a little app. which needs the same kind of functionalities.
Thanks.....
>1) Is it easy to get rid of the checkboxes (as I am filtering the source they are always >checked)? Maybe subclass and override the function?
>3) The ImageField control seems to require that the record is added before the image can be >selected. This is a pain because you have to add a PortfolioImage and then edit it to choose >an image.
-
Re: has_many editor

25 November 2007 at 11:14am
No - not really. I still haven't found a satisfactory way of attaching multiple images to a page as none of the CMS controls are really designed for it.
The best solution I've found so far is to create folders of images and then link a page to a folder, although this doesn't allow much control of image order. Here's the (simplified) code for a "Gallery Page" that we did for http://www.peterpetrou.com/
class GalleryPage extends Page {
static $has_one = array(
'Image' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Images', new ImageField('Image','Main Image'));
return $fields;
}
}class GalleryPage_Controller extends Page_Controller {
function Images() {
$imageFolder = $this->Image()->ParentID;
$images = DataObject::get("File", "ParentID = '$imageFolder'");
return $images;
}
}Each page has_one primary image, and all the other images that are in the same folder as the primary image are available using the Images function.
This idea was blatantly stolen from the Gallery module ;)
-
Re: has_many editor

18 July 2008 at 3:55am
Hi,
I copied your code-- thanks A LOT for that! I've been havnig a heck of a time trying to do the same thing.
My Images tab is showing up nicely, my popup's got the right fields, I can enter the title and upload the image and all that. However, one small problem:
After I click SAVE and close the popup, I see that it does not appear on the list, which I assume means it has not been saved to the Database?
What could I be doing wrong here?
Thanks,
Garrett -
Re: has_many editor

18 July 2008 at 7:36am
I did, I did, yes.... You know what it was? It was this line:
"PortFolioID = {$this->ID}"
Mine needed to be "ProjectPageID = {$this->ID}".
Thanks! Image gallery is rocking now!
//Garrett
-
Re: has_many editor

2 August 2008 at 11:23pm
Hi.
I developed a cms extension that allows you to attach multiple files/images to a Page. You seem to have resolved your problem, but maybe this could still be of interest for you:
http://www.silverstripe.com/extending-hacking-silverstripe-forum/flat/134180Cheers
| 6451 Views | ||
| Go to Top |





