Beispiel #1
0
 /**
  * Initializes the default configuration for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   KObjectConfig $config Configuration options
  * @return void
  */
 protected function _initialize(KObjectConfig $config)
 {
     //Add default toolbars only if the controller is being dispatched and the user is logged in.
     $toolbars = array();
     $toolbars[] = $this->getIdentifier()->name;
     if ($this->getIdentifier()->domain === 'admin') {
         $toolbars[] = 'menubar';
     }
     $config->append(array('toolbars' => $toolbars, 'behaviors' => array('editable', 'persistable')));
     parent::_initialize($config);
 }
Beispiel #2
0
 protected function _initialize(KObjectConfig $config)
 {
     $config->append(array('behaviors' => array('purgeable')));
     if ($this->getIdentifier()->getPackage() != 'activities') {
         $aliases = array('com:activities.model.activities' => array('path' => array('model'), 'name' => KStringInflector::pluralize($this->getIdentifier()->getName())), 'com:activities.controller.behavior.purgeable' => array('path' => array('controller', 'behavior'), 'name' => 'purgeable'), 'com:activities.controller.permission.activity' => array('path' => array('controller', 'permission')), 'com:activities.controller.toolbar.activity' => array('path' => array('controller', 'toolbar')));
         foreach ($aliases as $identifier => $alias) {
             $alias = array_merge($this->getIdentifier()->toArray(), $alias);
             $manager = $this->getObject('manager');
             // Register the alias if a class for it cannot be found.
             if (!$manager->getClass($alias, false)) {
                 $manager->registerAlias($identifier, $alias);
             }
         }
     }
     parent::_initialize($config);
 }