function block_attributes_variable_info in Block Attributes 7
Implements hook_variable_info().
File
- ./
block_attributes.variable.inc, line 10 - Variable module integration for the block_attributes module.
Code
function block_attributes_variable_info() {
$variable = array();
$attributes = block_attributes_get_block_attribute_info();
// Iterate through all defined attributes.
foreach ($attributes as $attribute => $info) {
// Enable attribute checkbox.
$variable["block_attributes_{$attribute}_enable"] = array(
'title' => t('Enable the @attribute attribute.', array(
'@attribute' => drupal_strtolower($info['label']),
)),
'description' => t('Check this box if you want to enable the <em>@attribute</em> attribute. Uncheck to disable @attribute.', array(
'@attribute' => drupal_strtolower($info['label']),
)),
'type' => 'boolean',
'default' => $info['enabled'],
'group' => 'block_attributes',
);
// Field for the default value.
$variable["block_attributes_{$attribute}_default"] = array(
// Override the label for the default attribute.
'title' => t('Default value for the @attribute attribute.', array(
'@attribute' => drupal_strtolower($info['label']),
)),
'group' => 'block_attributes',
'element' => array(
'#states' => array(
'invisible' => array(
'input[name="block_attributes_' . $attribute . '_enable"]' => array(
'checked' => FALSE,
),
),
),
) + $info['form'],
);
}
return $variable;
}