Annoyingly simple widget dev question

I have what should be a really simple problem that I'm having trouble working with. I have a widget that I've written that displays a blog feed that the user can select. I would like the user to have a pulldown menu displaying all their friends in the edit panel, which the view.php file of the widget then uses to get the correct blog feed.

I'm having a lot of trouble writing the code for just a pulldown menu populated with the user's friends, which then passes the GUID to view.php

Part of the problem is the inconsistancy between using HTML input fields or Elgg's own views - the Hello World widget tutorial does it one way (using input/pulldown), but the Flickr example in the Widget docs do it the other! (plain HTML field). I hoped I could just use the code from the messaging plug-in, but that also uses plain HTML, not Elgg's input views.

Can anyone help me out with some code that would do this? I've been working on this for hours, and I'm not making any progress. Thanks so much in advance!

  • The flickr/messaging plugins are older and weren't updated to use the built in core views. The advantage of the core views is picking up the same css styles and filtering of content.

    You need to post you code here if you want someone to point out any problems.

  • Well, ideally I want to use the built-in pulldown view, so I have this:

    echo elgg_view('input/pulldown',
                             array(    'name'=>'send_to',

    ...which populates a pulldown with a list of friend name ($friendnames is an array created by iterating through an array of $friend objects), but this doesn't pass anything back to view.php. What I really want to know is if I can just take the array returned by get_friends(), have the user select a friend name, and then have view.php pick up the GUID of that friend. Thanks again.

  • The hello wodget tutorial says: "The name of the input text box is params[message] because Elgg will automatically handle widget variables put in the array params. The actual php variable name will be message"

    You are not using params[] and so Elgg will not automatically pass that variable.