function cck_blocks_form_alter in CCK Blocks 6
Implementation of hook_form_alter().
Adds options to the field configuration page for making the field available as a block for every content type that uses it.
File
- ./
cck_blocks.module, line 163
Code
function cck_blocks_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'content_field_edit_form':
if (isset($form_state['change_basic'])) {
// Break if this is a basic information page.
break;
}
$field_name = $form['#field']['field_name'];
// Global settings form
$form['field']['global_cck_blocks_settings'] = array(
'#type' => 'radios',
'#title' => t('Provide block for this field'),
'#default_value' => variable_get('cck_blocks_' . $field_name . '_block_availability', CCK_BLOCKS_FIELD_BLOCK_DISABLED),
'#description' => t('When enabled, this field becomes available as a block in the block admin page.'),
'#options' => array(
CCK_BLOCKS_FIELD_BLOCK_DISABLED => t('Disabled'),
CCK_BLOCKS_FIELD_BLOCK_ENABLED => t('Enabled'),
),
);
// Add custom submit handler for the form:
$form['#submit'][] = 'cck_blocks_field_settings_submit';
break;
}
}