How to remove description from entities list ?

I want to show entities list without any description or excerpt  , is it possible ?

I use elgg_list_entities($options) ,

  • Suppose you want to do this for the bookmarks plugin,

    • Create a new plugin - lets call it bookmarks_customized and place it under bookmarks plugin
    • Copy the mod/bookmarks/views/default/object/bookmarks.php file to he mod/bookmarks_customized/views/default/object/bookmarks.php
    • Open that file with a code editor (dreamweaver, notepad, notepad++ etc) and go through the code.
    • Go through the last part of code and adjust the code as per your needs/
  • Summary (shows 'excerpt'  of entity):

    • clone file views\default\object\elements\summary.php to mod\your_plugin\views\default\object\elements\summary.php
    • remove/comment it into this cloned file:
    if ($content) {
        echo "<div class=\"elgg-content\">$content</div>";
    }

     

    Full view (shows 'description' of entity):

    add 'full_view' => false, in options:

    $options = array(
            'type' => 'object',
            'subtype' => 'blog',
            'full_view' => false,
            .........................
        );

    and call now:

    echo elgg_list_entities($options) ;

     

  • I would suggest using the view_vars hook. Overwriting those views might cause issues during upgrades.

    elgg_register_plugin_hook_handler('view_vars', 'object/elements/summary', 'my_plugin_customize_object_summary');
    
    function my_plugin_customize_object_summary($hook, $type, $vars, $params) {
        $entity = elgg_extract('entity', $vars);
        if (!$entity instanceof ElggObject) {
           return;
        }
        
        $subtypes = ['bookmarks', 'blog']; // object subtypes where you want to strip the description
        
        if (in_array($entity->getSubtype(), $subtypes)) {
           unset($vars['content']);
        }
    
        return $vars;
    }