Low Variables Documentation

Fieldtype Bridges

To make your fieldtype compatible with Low Variables, you can choose to return TRUE for the content type low_variables in your accepts_content_type method. You can also use specific methods which are called. As a rule, these methods are named var_x, where x is the original method name.
Note: The var_display_field method must be defined in your fieldtype in order to show up in Low Variables.
Fieldtypes that are called by Low Variables have the following properties available:

Properties

$this->content_type

  • Always set to low_variables.
  • $this->id

  • The variable ID; NULL when new or not known.
  • $this->name

  • The variable name; NULL when new or not known.
  • $this->row

  • The entire variable row, including variable data, label, and more.
  • $this->settings

  • The (decoded) variable settings.
  • You can use the following methods in your fieldtype to further enhance Low Variables compatibility.

    var_display_field (required)

    Displays the input field on the module home page. You can access the current variable id with $this->id. Arguments

  • $data (string) — The current variable data.
  • Return

  • A string containing the HTML to be used in the module’s home page.
  • var_display_settings

    If the fieldtype has settings, use this method to display them. You can access the current variable id with $this->id. Arguments

  • $settings (array) — The current variable’s settings.
  • Return

  • An array containing two elements: the name/label in the first element, the form element(s) in the second.
  • var_save_settings

    (PreviouslyUse this method to catch the settings values before saving them to the database. Arguments

  • $settings (array) — The posted variable’s settings.
  • Return

  • An associative array containing the settings to be saved.
  • var_post_save_settings

    Use this method for additional processing when a (new) variable has been saved to the database. Arguments

  • $settings (array) — The posted variable’s settings.
  • Return

  • Null
  • var_save

    Use this method to catch the variable value before saving it to the database. Arguments

  • $data (string) — The posted variable data
  • Return

  • A string containing the modified variable data to be saved.
  • var_post_save

    Use this method to do something after the variable value has been saved to the database. Arguments

  • $data (string) — The current variable data.
  • var_replace_tag

    Use this method for displaying the variable value in your templates, using the {exp:low_variables:parse}, {exp:low_variables:single} and {exp:low_variables:pair} tags. Arguments

  • $data (string) — The current variable’s value.
  • $tagparams (array) — The tag parameters.
  • $tagdata (string) — The current tag data.
  • Return

  • A string containing the modified tagdata.
  • var_delete

    Use this method for additional processing before a variable is deleted. Arguments

  • $id (int) — The ID of the variable about to be deleted.
  • Return

  • NULL
  • Support

    Having problems setting up and/or using Low Variables? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.