7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » restrict creation of album
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 682 Views |
-
restrict creation of album

16 March 2010 at 10:15pm
I have extended album page and its working fine .
i want to restrict the creation of album in admin panel
it means i want to have only one album(default album),so that admin cannot create any other albumthank you in advance
-
Re: restrict creation of album

16 March 2010 at 10:34pm
Hi Rishi,
I think this can be done by using the canCreate method in your AlbumPage class.
function canCreate() {
if(DataObject::get_one('AlbumPage')) {
return false;
} else {
return true;
}
} -
Re: restrict creation of album

17 March 2010 at 2:41am
Yeah, create a subclass of ImageGalleryAlbum, and create a function like:
public function canCreate() {
return !DataObject::get_one(__CLASS__);
}Then create a subclass of ImageGalleryPage, and assign the new album class
protected $albumClass = "MyAlbumSubclass";
-
Re: restrict creation of album

17 March 2010 at 5:35pm
thank you UC and bartvanirsel
that solve my problem.thanks a lot
| 682 Views | ||
|
Page:
1
|
Go to Top |


