You are here

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

Parameters

object $entity:

Overrides EntityAPIControllerExportable::save

File

modules/bat_event/bat_event.module, line 1530
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 save($entity, DatabaseTransaction $transaction = NULL) {
  if (empty($entity->{$this->idKey})) {

    // Create all tables necessary for this Event Type.
    bat_event_create_event_type_schema($entity->type);

    // Create a field of type 'Entity Reference' to reference a Bat Unit.
    bat_event_type_add_target_entity_field($entity);
    if (isset($entity->fixed_event_states)) {
      if ($entity->fixed_event_states) {

        // Create a field of type 'Bat Event State Reference' to reference an Event State.
        bat_event_type_add_event_state_reference($entity);
      }
    }
  }
  return parent::save($entity);
}