Hi,
I'm new to developing with Elgg and am trying to create a plugin.
I'm using the following command to get metadata pairs and want to output them in a list in the format of
<div>$label $url
which would display like
Google http://www.google.com
Yahoo http://www.yahoo.com
I'm not sure if this code is correct or not.
$metadata = elgg_get_entities_from_metadata(array(
'types'=>'object',
'subtypes'=>'preset_site',
'metadata_name_value_pairs' => array(
array('name' => 'label', 'value' => $label),
array('name' => 'url', 'value' => $url)
),
));
So I have 2 questions.
1. Will this command do what I expect and store the meta data pairs in $metadata?
2. How do I extract individual values so I can echo them to html with my own formatting?
I've looked for a good reference on how to do this but have come up blank.
I tried elgg_list_entities_from_metadata($options); but it doesn't give me the layout I want.
Thanks!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
You must log in to post replies.No, it'l store entities
This will get you all entities (in $metadata) were label == $label and url == $url.
You can then loop through $metadata like
you can add your own layout as you wish.
have you looked at http://learn.elgg.org/en/stable/tutorials/index.html
You can't store multiple key => value pairs under the same metadata name. You will have to create a new entity for each combination: