object view type

Hello all,

My problem is that I have create an object view in: ../mod/myplugin/views/default/object/myplugin.php and inside this file I have the following snipet: 

echo elgg_view_title($vars['entity']->title);
echo elgg_view('output/tags', array('tags' => $vars['entity']->somefield));
echo elgg_view('output/tags', array('tags' => $vars['entity']->tags));

The problem is that this code never been executed. What I'm missing to make my own object view for my plugin.

Thx, 

  • Views in views/default/object/ are automagic and correspond to entity subtype.

    Consider this code:

    $myentity = new ElggObject();

    $myentity->subtype = 'my_entity_subtype';

    ...

    $myentity->save();

    echo elgg_view_entity($myentity);

     

    The last bit will look for /views/default/object/my_entity_subtype.php and will fall back to /views/default/object/default.php if the view does not exist.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking