I trying to create a new custom field, which will have a select field with menu items from certain menu type, I got stuck at populating this select field with values from database.

You can see the code here.

Also I need to access these 3 object properties (id, title, link) on frontend, so the goal is to have in table #__fields_values in value column record like this:


I got to this point:


If I print DB query correct values are returned:

Array ( 
   [0] => stdClass Object ( 
        [id] => 101 
        [title] => Home 
        [link] => index.php?option=com_content&view=featured ) 

   [1] => stdClass Object ( 
        [id] => 115 
        [title] => Article 
        [link] => index.php?option=com_content&view=article&id=1 ) 

But I don't know, how to get this in the select field.

Any help would be appreciated.

  • Are you saying that you already tried return $db->loadObjectList(); and you aren't able to access and convert the data to html option tags? As an aside, I recommend using quote("mainmenu") for sql portability /consistency. – mickmackusa Apr 24 at 10:17
  • The link to your script now seems to be broken -- this is why we ask that all question details be written statically on the page. – mickmackusa Apr 25 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.