Streams API Utilities Driver
The utilities driver is used to run uncommon streams functions that usually have to do with data setup and teardown.
You can call the entries driver like this:
$this->load->driver('Streams');
$this->streams->utilities->function();
remove_namespace($namespace_slug)
The remove_namespace() function with destroy all data associated with a namespace. This includes:
- Streams metadata in the namespace
- Fields metadata in the namespace
- Streams tables in the namespace
Obviously, this should be used with caution!
convert_table_to_stream($table_slug, $namespace_slug, $prefix, $stream_name, $about = NULL, $title_column = NULL, $view_options = array('id', 'created'))
The convert_table_to_stream() function takes an existing table and creates the streams metadata for it based on the given parameters.
This will add each of the four standard streams fields:
- created
- updated
- created_by
- ordering_count
convert_column_to_field($stream_slug, $namespace, $field_name, $field_slug, $field_type, $extra = array(), $assign_data = array())
Allows you to take an existing column in a stream table that has not been added as a field, and convert it into a field. This simply creates the metadata around the field, it does nothing to the actual column in the table or its properties.
This is a useful function for when you are converting an existing table to a stream - you can convert the table to a stream, and then go through and convert all of the existing columns to fields.
The $field_slug should be the same name as the column you are converting. The $extra array is extra field parameters, and the $assign_data array allows you to pass these optional assignment parameters:
required | Boolean. Whether or not this field should be required. Defaults to false. |
unique | Boolean. Whether or not this field should be unique in the stream. Defaults to false. |
title_column | Boolean. Whether or not this field should be the title column. Defaults to false. |
instructions | String. Instructions that will appear on the entry form next to this field. |