You are here

function _maxlength_admin_settings in Maxlength 6

Same name and namespace in other branches
  1. 5.2 maxlength.module \_maxlength_admin_settings()
  2. 5 maxlength.module \_maxlength_admin_settings()
1 string reference to '_maxlength_admin_settings'
maxlength_menu in ./maxlength.module
Implemenation of hook_menu().

File

./maxlength.module, line 44

Code

function _maxlength_admin_settings() {
  $form = array();
  foreach (node_get_types() as $type => $name) {
    $code = MAXLENGTH_NODE_TYPE . $type;
    $type_info = node_get_types('type', $type);
    $form['nodetypes'][$type] = array(
      '#type' => 'fieldset',
      '#title' => $name->name,
      '#collapsible' => TRUE,
      '#collapsed' => strlen(variable_get($code . '_t', '') . variable_get($code . '_b', '')) == 0,
    );
    $form['nodetypes'][$type][$code . '_t'] = array(
      '#type' => 'textfield',
      '#title' => t('!label Maxlength', array(
        '!label' => $type_info->title_label,
      )),
      '#field_suffix' => t('characters'),
      '#return_value' => 1,
      '#default_value' => variable_get($code . '_t', ''),
      '#description' => t('Maximum number of characters allowed for the title field of this content type. Leave blank for an unlimited size.'),
    );
    $form['nodetypes'][$type][$code . '_b'] = array(
      '#type' => 'textfield',
      '#title' => t('!label Maxlength', array(
        '!label' => $type_info->body_label,
      )),
      '#field_suffix' => t('characters'),
      '#return_value' => 1,
      '#default_value' => variable_get($code . '_b', ''),
      '#description' => t('Maximum number of characters allowed for the body field of this content type. Leave blank for an unlimited size.'),
    );
  }
  return system_settings_form($form);
}