function select2widget_render_modes in Select2 Field Widget 7.2
Render entities using display mode
Parameters
$entity_labels:
string $view_mode:
Return value
array
1 call to select2widget_render_modes()
- select2widget_entityreference_get_matches in ./
select2widget.entityreference.inc - Return JSON based on given field, instance and string.
File
- ./
select2widget.entityreference.inc, line 210
Code
function select2widget_render_modes($entity_labels, $view_mode = "full", $entity_type = "node") {
$matches = array();
foreach ($entity_labels as $values) {
$ids = array_keys($values);
$entities = entity_load_multiple_by_name($entity_type, $ids);
foreach ($entities as $entity) {
$entity_array = select2widget_render_entity($entity_type, $entity, $view_mode);
$matches[] = array(
'id' => $entity_array['id'],
'title' => $entity_array['title'],
'data' => '<div class="reference-select2widget">' . render($entity_array['data']) . '</div>',
);
}
}
return $matches;
}