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.

Customising the CMS /

Can't set canEdit and canCreate in a Decorator


Reply


2 Posts   1055 Views

Avatar
Martijn

Community Member, 271 Posts

28 July 2010 at 9:03am

Ok, I feel quite stupid now, cause this must be very simple:

This returns true:
Object::has_extension('ErrorPage',"ErrorPageDecorator");

But the canCreate() and canEdit() in the Decorator does not change anything in the CMS...

<?php
// _config.php : Object::add_extension('ErrorPage','ErrorPageDecorator');
class ErrorPageDecorator extends DataObjectDecorator{
   
   function __construct() {
      parent::__construct();
   }
   
   function canCreate(&$member) {
      //return Permission::check("ADMIN");
      return false;
   }
   
   function canEdit(&$member){
      return false;   
   }
}

What am i missing?

Avatar
Martijn

Community Member, 271 Posts

28 July 2010 at 10:49pm

OK,

Seems this does work when not logged in as admin....