function commons_events_entity_view_alter in Drupal Commons 7.3
Implements hook_entity_view_alter().
File
- modules/
commons/ commons_events/ commons_events.module, line 202  
Code
function commons_events_entity_view_alter(&$build, $type) {
  if ($type == 'node' && isset($build['#node'])) {
    $node = $build['#node'];
    list(, , $bundle) = entity_extract_ids('node', $node);
    if ($bundle == 'event') {
      $build['attending'] = array(
        0 => theme('commons_events_attending_event', array(
          'event' => $node,
          'attendee_count' => commons_events_get_raw_attendee_count($node),
        )),
        '#weight' => -10,
      );
      // Don't show the address if the event location is only online.
      $items = field_get_items('node', $node, 'field_location');
      if (is_array($items)) {
        foreach ($items as $item) {
          if ($item['value'] == 'online') {
            $build['field_address']['#access'] = FALSE;
          }
        }
      }
    }
  }
}