Hi,
I have a question about ModelAdmin and the canCreate method.
I created a DataObject with the canCreate, canDelete, canEdit and canView methods. As a test, I always return false in the canCreate() method:
class Animal extends DataObject {
//stuff omitted ....
function canCreate($member=null){
/**if(Permission::check('CREATE_ANIMAL'))
return true; **/
//Security::permissionFailure();
return false;
}
//canEdit, canView, canDelete...
}
The ModelAdmin is pretty standard, I think:
class AnimalAdmin extends ModelAdmin {
public static $managed_models = array(
'Animal',
'Category'
);
static $url_segment = 'animals';
}
However, the ModelAdmin always shows the Add button (see Attachment) and it always allows me to save the entry when I click the Add button. It respects all other methods (e.g. I can't delete an entry).
Can anybody tell me what I'm doing wrong with the canCreate() method?