Variable API

Events happening in the community are now at Drupal community events on www.drupal.org.
pillarsdotnet's picture

The vars and the variable modules both show in the module listing as "Variables API". They were created within two months of each other and offer similar functionality.

Feature Variable Vars
Machine name variable vars
Display name Variable API Variable API
Author Jose Reyero kiam
Description Variable API Implement an API to handle persistent variables.
Tests 0 18
Reported users 953 169
Version reviewed 7.x-1.x 7.x-2.x
Other versions 6.x-1.x 6.x-1.x, 6.x-2.x, 7.x-1.x
Code Size 9k 48k
Installed Size 28k 76k
Unique features
Provides new hooks:
hook_variable_info($options)
Define variables used by a module.
hook_variable_type_info()
Define types of variables or list of values used by a module.
hook_variable_group_info()
Define groups of variables used by a module.
Provides new tokens:
[variable:$name]
Supports core modules:
forum, locale, menu, node, system, taxonomy, translation, user
Implements hook_node_type_delete()
Handles removal of per-node-type variables on node-type deletion.
API
variable_children($names)
Get list of variables expanding multiple ones
variable_delete($variable)
Delete variable (included children variables)
variable_format_value($variable, $options)
Format printable value
variable_get_child($parent, $key, $options)
Get variable child element from multiple variable
variable_get_default($variable, $options)
Get variable default
variable_get_group($group)
Get variable group information.
variable_get_info($name, $options)
Get variable information
variable_get_option($type)
Get variable option information.
variable_get_type($type)
Get variable type information.
variable_get_value($variable, $options)
Get value for simple scalar variable
variable_include($variable)
Include extended API and files related to specific variable
variable_list($names)
Provide list of variable titles
variable_set_value($name, $value, $options)
Set variable value
variable_static($type, $options)
Get variable static data, try the cache, or invoke the hook to collect it.
variable_type_include($type)
Include variable type files
Vars::api($minimum, $maximum)
Verifies the current API version is included between two values passed as arguments.
Vars::defaultValue($name)
Returns the default values for the variable passed as argument.
Vars::deleteVariables(array $names)
Deletes the specified persistent variables.
Vars::forceMenuRebuild()
Forces the menu rebuilding.
Vars::getDefaults()
Returns the default value for the variables used by the module.
Vars::getLibraryPath($library)
Returns the list of the directories where library files are looked in.
Vars::loadDefaults($cid, DatabaseCondition $conditions)
Loads the default value for all the variables respecting some conditions.
Vars::offsetExists($offset)
Implements ArrayAccess::offsetExists().
Vars::offsetGet($offset)
ArrayAccess::offsetGet().
Vars::offsetSet($offset, $value)
Implements ArrayAccess::offsetSet().
Vars::offsetUnset($offset)
Implements ArrayAccess::offsetUnset().
Vars::removeDefaults(array $set)
Removes the default values contained in the table variable_default.
Vars::renameVariables(array $names)
Renames persistent variables.
Vars::saveDefaults()
Saves the default value for the variables defined from the module.
Vars::siteIsOffline()
Checks if the site is offline.
Vars::staticReset($name)
Resets one or all centrally stored static variable(s).
Vars::&staticValue($name, $default_value, $reset)
Central static variable storage.
Form functions
variable_edit_form($form, $form_state, $list)
Form for variable list
variable_edit_subform($list)
Form elements for variable list
variable_module_form($form, $form_state, $module)
Form for module variables
variable_group_form($form, $form_state, $group)
Form for group variables
variable_form_element($variable, $options)
Build form element for a variable
variable_form_element_array($variable, $options)
Build array form element
variable_form_element_multiple($variable, $options)
Build multiple form element
variable_form_element_default($variable, $options)
Build default form element
variable_form_element_options($variable, $options)
Build options variables
theme_variable_table_select($variables)
Form to select variables
Submodules
Variable admin
Variable API - Administration UI
Variable realm
Variable API - Realms
Variable store
Variable API - Database storage for variable realms

Comments

Issue ticket links

pillarsdotnet's picture

Posted tickets to both modules' issue queues urging the maintainers to merge.

http://drupal.org/node/1099632

http://drupal.org/node/1099630

DX: Finally implement Variable API in core

lars toomre's picture

I created a new issue at http://drupal.org/node/1124198 with the hope of getting a unified Variable API implemented into Drupal 8.

Similar Module Review

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week