Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,48 @@ drupalgap.settings.flag = {

The flag module for DrupalGap will automatically prepend a flag button to an entity's content when the entity is being viewed.

### Render Flags on Custom Entity Rendering

If you override the default node display following the tutorial found here (http://docs.drupalgap.org/7/Entities/Rendering_Entities), then you can easily display flags on your custom rendering using the following code example:

```
function my_module_team_page(node) {
var content = {};

var entity_type = 'node';
var bundle = node.type;
var entity_id = node.nid

var flags = flag_get_entity_flags(entity_type, bundle);

var page_id = drupalgap_get_page_id();
$.each(flags, function(fid, flag) {

// Build the render array.
content['flag_' + fid]= { markup: '<div id="' + flag_container_id(flag.name, entity_id) + '" class="flag"></div>' +
drupalgap_jqm_page_event_script_code(
{
page_id: page_id,
jqm_page_event: 'pageshow',
jqm_page_event_callback: '_flag_pageshow',
jqm_page_event_args: JSON.stringify({
fid: fid,
entity_id: entity_id,
entity_type: entity_type,
bundle: bundle
})
},
entity_type + '-' + entity_id + '-' + flag.fid
) };

});

return content;
}


```

#### Views Render Array Row Quick Links for Flags

If you'd like to provide flags next to some list items from a Views Render, set up your Views JSON to return something like this:
Expand Down