function variable_example_variable_info in Variable 7
Same name and namespace in other branches
- 7.2 variable_example/variable_example.variable.inc \variable_example_variable_info()
Implements hook_variable_info().
File
- variable_example/
variable_example.variable.inc, line 10 - Variable API module. Definition for some xample variables
Code
function variable_example_variable_info($options) {
// Simple text
$variables['variable_example_text'] = array(
'type' => 'text',
'title' => t('Simple text', array(), $options),
'default' => 'Example text.',
'description' => t('Example of text variable.', array(), $options),
'required' => TRUE,
'group' => 'variable_example',
);
// Text with format
$variables['variable_example_text_format'] = array(
'type' => 'text_format',
'title' => t('Text format', array(), $options),
// The default value may be a string (default format will be added) or
// an array with 'format' (format name) and 'value' (string) elements
'default' => 'Example text with default format',
'description' => t('Example of text variable with text format.', array(), $options),
'required' => TRUE,
'group' => 'variable_example',
);
// Text with format
$variables['variable_example_mail_[mail_part]'] = array(
'type' => 'mail_text',
'title' => t('Example mail', array(), $options),
'default' => array(
'subject' => t('Example mail subject', array(), $options),
'body' => t('Example mail body.', array(), $options),
),
'description' => t('Example mail variable with subject and body.', array(), $options),
'required' => TRUE,
'group' => 'variable_example',
);
return $variables;
}