function block_attributes_get_block_attribute_info in Block Attributes 7
Fetch an array of block attributes.
3 calls to block_attributes_get_block_attribute_info()
- block_attributes_settings in ./
block_attributes.admin.inc - Block Attributes settings form.
- block_attributes_variable_info in ./
block_attributes.variable.inc - Implements hook_variable_info().
- _block_attributes_form_alter in ./
block_attributes.module - Add the block attributes fields to a block add or configuration form.
File
- ./
block_attributes.module, line 201 - Enhanced control over the HTML attributes of any Block.
Code
function block_attributes_get_block_attribute_info() {
// Collect an array of all attributes defined in code.
$attributes = module_invoke_all('block_attribute_info');
// Merge in default values.
foreach ($attributes as $attribute => &$info) {
$info += array(
'form' => array(),
'enabled' => variable_get("block_attributes_{$attribute}_enable", 1),
'default' => '',
);
// Fields types default to textfield.
$info['form'] += array(
'#type' => 'textfield',
'#title' => $info['label'],
'#description' => isset($info['description']) ? $info['description'] : '',
// Attempt to use user defined default values in settings form.
'#default_value' => variable_get("block_attributes_{$attribute}_default", $info['default']),
);
}
// Allow users to alter block attributes definition from code, see API file.
drupal_alter('block_attribute_info', $attributes);
return $attributes;
}