function field_collection_views_handler_field_host_entity_path::render in Field Collection Views 7
Same name and namespace in other branches
- 8 views/field_collection_views_handler_field_host_entity_path.inc \field_collection_views_handler_field_host_entity_path::render()
Work out the host_entity_path
Overrides views_handler_field::render
File
- views/
field_collection_views_handler_field_host_entity_path.inc, line 27 - Contains the host_entity_path field handler.
Class
- field_collection_views_handler_field_host_entity_path
- Field handler to display the host_entity_path
Code
function render($values) {
$host_entity_path = "";
$item_id = $values->item_id;
//debug($values);
$field_collection_item = field_collection_item_load($item_id);
$host_entity_id = $field_collection_item
->hostEntityId();
if (!empty($host_entity_id)) {
$host_entity_type = $field_collection_item
->hostEntityType();
if (!empty($host_entity_type)) {
$host_entitys = entity_load($host_entity_type, array(
$host_entity_id,
));
if (isset($host_entitys[$host_entity_id])) {
$host_entity = $host_entitys[$host_entity_id];
//debug($host_entity);
//$host_entity = profile2_load($host_entity_id);
$host_entity_uri = entity_uri($host_entity_type, $host_entity);
$host_entity_path = isset($host_entity_uri['path']) ? $host_entity_uri['path'] : "";
}
}
}
return $host_entity_path;
}