Connect Types to Events¶
In BAT we try to have the least possible amount of things hard-coded. This allows us to create truly flexible booking systems. However, it also means that we need to explain all these connections to the framework.
In Type Bundles we created a Meeting Room Type and in Events we created two types of events for availability and pricing. We now have to connect the two. In other words, we need to let BAT know that our meeting rooms types will have events of the type Meeting Room Available and Pricing associated with them.
Default event value fields¶
You connect Type Bundles to event types through a default event value field.
A default value event field holds the value for a given type of event before any actual events are created. For the meeting room example, these will hold the default values for Availability and Pricing. Events associated with the meeting rooms will modify and overwrite these default values.
In order to understand the need for default value event fields, consider what would happen if we did not have them: We would have to create events for every single point in time so as to have an availability and price value associated with the meeting rooms. Default value event fields simply indicate that if there is not an explicit event for a given period in time, use the default value.
To create default value event fields visit
admin/bat/config/type-bundles and click on the manage fields operation of the type you are interested in and add fields to hold default event values.
Fixed State Events¶
Arbitrary state events¶
Similarly to fixed state events, arbitrary state events require a default value event field. The difference is, in this case it does not have to be in the BAT Event State Reference field. It has to be in a field, however, that holds an integer value or that we transform to an integer value. As a result, we only support a specific subset of fields.
Currently those are:
- Commerce Price
- The first step is to create the field - in our example we will create an Integer field that will hold the cost.
- We can now (under the Edit tab) link the Cost field to the Meeting Room Cost event type.
As we mentioned before, we can only handle a certain amount of fields for arbitrary values.
Now, at this point, all that has happened is that BAT can:
- Connect unit types to event types
- Store the right information regarding availability and cost (because these are the event types we defined)