Учусь по книге. Проробатываю пример с создание модуля для анотации.
annotate.module
<?phpfunction annotate_menu() {
$items['admin/settings/annotate'] = array(
'title' => t('Annotation settings'),
'Description' => t('Change how annotation behave'),
'page callback' => 'drupal_get_form',
'page arguments' => array('annotate_admin_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
'file' => 'annotate.admin.inc',
);
return $items;
}?>
annotate.admin.inc
<?phpfunction annotate_admin_settings() {
$options = node_get_types('names');
$form['annotate_node_types'] = array(
'#type' => 'checkbox',
'#title' => t('User may annotate these content types'),
'#options' => $options,
'#default_value' => variable_get('annotate_nodetypes', array('story')),
'#description' => t('A text field will be available on these content to make user-specific notes.'),
);
return system_settings_form($form);
}?>
$form имеет такое значение:
Array ( [0] => Array ( [#type] => checkbox [#title] => User may annotate these content types [#options] => Array ( [page] => Page [poll] => Poll [product] => Product [product_kit] => Product kit [profile] => Profile [story] => Story [submission] => Submission [page2] => page 2 ) [#default_value] => Array ( [0] => story ) [#description] => A text field will be available on these content to make user-specific notes. ) )
вроде все правильно, в админке должен появиться список типов узлов с чекбоксами, а выводиться такое:
Комментарии
'#type' => 'checkboxes'
спсибо