function properties_compare_entity_view in Dynamic properties 7
Implements hook_entity_view().
File
- properties_compare/
properties_compare.module, line 46 - Module file for privatemsg_compare module.
Code
function properties_compare_entity_view($entity, $type, $view_mode, $langcode) {
if (!user_access('compare properties')) {
return;
}
// Never display fields inside block list view.
if (strpos($view_mode, 'properties_compare') !== FALSE) {
return;
}
$extra_fields = field_extra_fields_get_display($type, field_extract_bundle($type, $entity), $view_mode);
// Verify if button should be displayed for this view mode.
if (isset($extra_fields['properties_compare']) && (!isset($extra_fields['properties_compare']['visibility']) || $extra_fields['properties_compare']['visibility'])) {
$entity->content['properties_compare'] = drupal_get_form('properties_compare_add_form_' . properties_compare_create_key($type, $entity), $type, $entity);
$entity->content['properties_compare']['#attributes'] = array(
'class' => array(
'compare-form',
),
);
}
}