Content Widget

Has anyone attempted to write a widget for the 'content' plugin? If not; Is it feasible for me to have a go?

  • Maybe this will be helpful to others (I'm afraid it's a bit of a hatchet job; and totally plagarised from the pages plugin), but I managed to get it working as a widget to display the content created by a user completing and submitting a content form.

    <?php

         /**
         * Elgg forms widget edit
         *
         * @package ElggPages
         * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
         * @author Curverider Ltd <info@elgg.com>
         * @copyright Curverider Ltd 2008-2010
         * @link http://elgg.com/
         */
        
         $num_display = (int) $vars['entity']->pages_num;
         if (!$num_display) {
             $num_display = 10;
         }
        
         $pages = elgg_list_entities(array('types' => 'object', 'subtypes' => 'form_data', 'container_guid' => page_owner(), 'limit' => $num_display, 'full_view' => FALSE));
       
       
         
         echo "<div id=\"pages_widget\">" . $pages . "</div>";
         
         $user_inbox = $vars['url'] . "mod/form/my_forms.php?id=26&form_view=mine" . page_owner_entity()->username;
         echo "<div class=\"widget_more_wrapper\"><a href=\"{$user_inbox}\">".elgg_echo('form:more')."</a></div>";
        
    ?>

    It's probably not a very good example of coding and 'how to', but I have seen a couple of threads asking for the same thing and it might work as a solution for others.

    However, now that I've got this far, I wondered if a proper professional can help with the last tiny little bit?

    My form has a field named 'title'. I want the content of this field to appear in the listing - please see image below:

    Widget Dump

     

    I did manage to get the title to display when I tried modifying the 'bookmarks' widget - but I can't reproduce it : (

Form and related plugins

Form and related plugins

User-generated content, flexible user and group profiles, registration forms, custom file forms