function ddblock_settings_form in Dynamic display block 6
Same name and namespace in other branches
- 7 ddblock.admin.inc \ddblock_settings_form()
Dynamic display block settings form for setting the content types to be used with the dynamic display block module.
1 string reference to 'ddblock_settings_form'
- ddblock_menu in ./
ddblock.module - Implementation of hook_menu().
File
- ./
ddblock.admin.inc, line 247 - admin blocks of the ddblock module.
Code
function ddblock_settings_form() {
$form = array();
// get a list of all available content types, names parameter is used to get an associative array of content type names.
// the key is the machine-readable name of the content type and the value the human-readable name of the content type.
$content_types = node_get_types('names');
$form['ddblock_node_type'] = array(
'#type' => 'checkboxes',
'#title' => t('Content types'),
'#description' => t('The content type(s) that can be used with the dynamic display block module.'),
'#default_value' => variable_get('ddblock_node_type', array()),
'#options' => $content_types,
'#multiple' => TRUE,
'#required' => FALSE,
);
// Fetch blocks directly from modules using block.module function.
$blocks = _block_rehash();
// Sort blocks how we want them.
usort($blocks, 'ddblock_block_sort');
// Turn $blocks into form options of available blocks.
$options = array();
foreach ($blocks as $block) {
// Don't include ddblock module blocks in the list.
if ($block['module'] != 'ddblock') {
$options[$block['module'] . ':' . $block['delta'] . ':' . $block['info']] = $block['module'] . ' - ' . $block['info'];
}
}
$form['ddblock_blocks'] = array(
'#type' => 'checkboxes',
'#title' => t('Blocks'),
'#description' => t('The block(s) that can be used with the dynamic display block module.'),
'#default_value' => variable_get('ddblock_blocks', array()),
'#options' => $options,
'#multiple' => TRUE,
'#required' => FALSE,
);
$form['#redirect'] = 'admin/settings/ddblock/list';
return system_settings_form($form);
}