public function BatEvent::getEventValue in Booking and Availability Management Tools for Drupal 7
Returns the value stored for this event in a way that BAT can work with it.
Return value
mixed
1 call to BatEvent::getEventValue()
- BatEvent::defaultLabel in modules/
bat_event/ bat_event.module - Return the event label.
File
- modules/
bat_event/ bat_event.module, line 1136 - Manage Events - Events store the EventValue of a Unit over a period of time.
Class
- BatEvent
- The class used for Event entities.
Code
public function getEventValue() {
if ($field = $this
->getEventValueField()) {
$field_info = field_info_field($field);
$values = field_get_items('bat_event', $this, $field);
if (!empty($values)) {
if ($field_info['type'] == 'bat_event_state_reference') {
return $values[0]['state_id'];
}
elseif ($field_info['type'] == 'commerce_price') {
return $values[0]['amount'];
}
elseif ($field_info['type'] == 'text' || $field_info['type'] == 'number_integer' || $field_info['type'] == 'number_decimal') {
return $values[0]['value'];
}
}
else {
return FALSE;
}
}
}