All add-ons

Low Variables

Compatibility: EE1, EE2
Latest release: 2.2.1 (released 2012-04-24)
Licensing: Commercial License Agreement

Helper functions

There are a couple of built-in functions you can use to make Variable type development even easier than it already is. The EE2 compatible version makes use of the form_helper functions provided by CodeIgniter. The EE1 compatible version has 3 of those functions available: form_dropdown(), form_multiselect() and form_prep().

array_to_select

Feed it options, and you get select <option>s back. This function is depricated since v1.2.0. Use form helper functions or select_element instead.

Arguments

  • $options (array) — associative array with option values and labels.
  • $selected (array, optional) — array containing values that should be selected.
  • $name (string, optional) — if defined, the options will be wrapped around a <select>-tag with given name.
  • $multi (bool, optional) — if set to TRUE, the <select>-tag will be a multiple-select element.

Returns

A string containing the options.

drag_lists

Generates two lists of dragable and sortable items, based on the options given.

Arguments

  • $var_id (int) — the ID of the variable you’re generating the lists for.
  • $rows (array) — associative array with item values and labels.
  • $selected (array, optional) — array containing values that should be selected.

Returns

A string containing the lists.

explode_options

Converts setting options to associative array. Every option is on a new line, keys and values are separated by  : .

Arguments

  • $options (string) — options to explode.

Returns

An array containing the exploded options.

flatten_results

Converts a query result set to a one-dimensional (flat) associative array.

Arguments

  • $result_set (array) — array with arrays, each of which is a row returned by the database.
  • $key (string) — attribute to use as key for the flat array.
  • $val (string) — attribute to use as value for the flat array.

Returns

A one-dimensional associative array.

get_setting

Gets a single setting value.

Arguments

  • $key (string) — the name of the setting you want to get.
  • $settings (array) — the settings array to look through first.

Returns

The value found in $settings, if not found, the default value from $this->default_settings or FALSE if the setting name is unknown.

input_name

Generates the input name for a given setting.

Arguments

  • $setting_name (string) — the name of the setting you want to generate the name for.
  • $multiple (bool, optional) — if set to TRUE, it will append [] to the output.

Returns

A string to be used for the name attribute of a variable setting.

insert_css

Adds inline css to the control panel.

Arguments

  • $css (string) — the css code.

insert_js

Adds inline javascript to the control panel.

Arguments

  • $js (string) — the javascript code.

interface_select

Creates a select-element for interface selection. The variable setting name must be multi_interface.

Arguments

  • $selected (string, optional) — item to be checked. Either select or drag-list.

Returns

A string containing the radio buttons to be used in the settings form.

select_element

Creates a select-element for given array used for the module’s home screen.

Arguments

  • $var_id (int) — id of the current variable.
  • $rows (array) — Associative array containing all possible values. Nested values will create optgroups.
  • $selected (array or string, optional) — Array or string containing selected key(s).
  • $multiple (bool, optional) — Return a multiple select element or not. Defaults to FALSE.

Returns

A string containing the select element for given variable.

separator_select

Creates radio buttons for Separator selection. The variable setting name must be separator.

Arguments

  • $selected (string, optional) — item to be checked. Either newline, pipe or comma.

Returns

A string containing the radio buttons to be used in the settings form.

setting_label

Creates the HTML for a form element’s label and notes.

Arguments

  • $name (string) — The name of the variable or element.
  • $notes (string, optional) — The variable notes or instructions.

Returns

A string containing the HTML to be used in the module’s home page or variable settings.