Example #1
0
 /**
  * (non-PHPdoc)
  * @see LibBaseViewJson::_getItem()
  */
 protected function _getItem()
 {
     $item = parent::_getItem();
     $context = new KCommandContext();
     $context->gadgets = new LibBaseTemplateObjectContainer();
     $context->actor = $this->_state->getItem();
     $context->composers = new LibBaseTemplateObjectContainer();
     $context->profile = new KConfig();
     if ($this->_state->getItem()->authorize('access')) {
         $this->_state->getItem()->components->registerEventDispatcher($this->getService('anahita:event.dispatcher'));
         $this->getService('anahita:event.dispatcher')->dispatchEvent('onProfileDisplay', $context);
         dispatch_plugin('profile.onDisplay', array('actor' => $this->_state->getItem(), 'profile' => $context->profile));
         $this->profile = $context->profile;
     }
     $item['gadgets'] = array_map(function ($gadget) {
         return $gadget->name;
     }, $context['gadgets']->getObjects());
     $item['composers'] = array_map(function ($gadget) {
         return $gadget->name;
     }, $context['composers']->getObjects());
     $item['information'] = $context['profile'];
     return $item;
 }