public function bat_type_handler_type_calendars_field::render in Booking and Availability Management Tools for Drupal 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- modules/
bat_unit/ views/ bat_type_handler_type_calendars_field.inc, line 34 - This field handler aggregates calendar edit links for a Bat Type under a single field.
Class
Code
public function render($values) {
$links = array();
$type = bat_type_load($this
->get_value($values, 'type_id'));
$type_bundle = bat_type_bundle_load($type->type);
if (is_array($type_bundle->default_event_value_field_ids)) {
foreach ($type_bundle->default_event_value_field_ids as $event_type => $field) {
if (!empty($field)) {
$event_type_path = 'admin/bat/calendar/' . $type->type_id . '/' . $event_type;
// Check if user has permission to access $event_type_path.
if (drupal_valid_path($event_type_path)) {
$event_type_label = bat_event_get_types($event_type)->label;
$links[$field] = array(
'title' => 'Manage ' . $event_type_label,
'href' => $event_type_path,
);
}
}
}
}
if (!empty($links)) {
return theme('links', array(
'links' => $links,
'attributes' => array(
'class' => array(
'links',
'inline',
'calendars',
),
),
));
}
else {
// Hide this field.
$this->options['exclude'] = TRUE;
}
}