You are here

public function BatEventTypeController::export in Booking and Availability Management Tools for Drupal 7

Parameters

object $entity:

string $prefix:

Overrides EntityAPIControllerExportable::export

File

modules/bat_event/bat_event.module, line 1567
Manage Events - Events store the EventValue of a Unit over a period of time.

Class

BatEventTypeController
The Controller for Event Type entities.

Code

public function export($entity, $prefix = '') {
  $vars = get_object_vars($entity);
  unset($vars[$this->statusKey], $vars[$this->moduleKey], $vars['is_new']);
  if ($this->nameKey != $this->idKey) {
    unset($vars[$this->idKey]);
  }

  // Export event states.
  if ($entity->fixed_event_states) {
    $event_states = array();
    foreach (bat_event_get_states($entity->type) as $state) {
      $event_states[] = array(
        'machine_name' => $state['machine_name'],
        'label' => $state['label'],
        'color' => $state['color'],
        'calendar_label' => $state['calendar_label'],
        'locked' => $state['locked'],
        'blocking' => $state['blocking'],
        'default_state' => $state['default_state'],
      );
    }
    $vars['event_states'] = $event_states;
  }
  return entity_var_json_export($vars, $prefix);
}