function weight_settings_form in Weight 6
Same name and namespace in other branches
- 5 weight.module \weight_settings_form()
- 7 weight.admin.inc \weight_settings_form()
@file This module uses the sticky column of the node table to add weighting to nodes.
1 string reference to 'weight_settings_form'
- weight_menu in ./
weight.module - Implementation of hook_menu().
File
- ./
weight.admin.inc, line 8 - This module uses the sticky column of the node table to add weighting to nodes.
Code
function weight_settings_form() {
drupal_add_css(drupal_get_path('module', 'weight') . '/weight.css');
$form = array();
$types = node_get_types('names');
$form['weight_range'] = array(
'#type' => 'radios',
'#title' => t('Node Weight Range'),
'#default_value' => variable_get('weight_range', 20),
'#options' => array(
5 => 5,
10 => 10,
20 => 20,
30 => 30,
40 => 40,
50 => 50,
60 => 60,
70 => 70,
80 => 80,
90 => 90,
),
'#description' => '<p>' . t('This will be the +/- range for node weight.') . '</p>',
'#attributes' => array(
'class' => 'container-inline',
),
);
$form['weight_use_menu'] = array(
'#type' => 'radios',
'#options' => array(
t('No'),
t('Yes'),
),
'#title' => t('Use Menu Weight'),
'#default_value' => variable_get('weight_use_menu', FALSE),
'#description' => '<p>' . t('If the node has not been weighted, should we use the menu item weight if there is one?') . '</p>',
'#attributes' => array(
'class' => 'container-inline',
),
);
$form['weight_content_admin'] = array(
'#type' => 'radios',
'#title' => t('Content Admin Page'),
'#options' => array(
t('No'),
t('Yes'),
),
'#default_value' => variable_get('weight_content_admin', TRUE),
'#description' => '<p>' . t('Show the weight on the content admin page? NOTE: You will need to clear the Theme Registry after changing this option.') . '</p>',
'#attributes' => array(
'class' => 'container-inline',
),
);
$form['node'] = array(
'#type' => 'fieldset',
'#title' => t('Node weight selector settings'),
'#description' => '<p>' . t('These settings are for the Weight section of the node form.') . '</p>',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['node']['weight_position'] = array(
'#type' => 'weight',
'#delta' => 10,
'#title' => t('Weight selector position weight'),
'#default_value' => variable_get('weight_position', 0),
'#description' => '<p>' . t('This controls where the selection for node weight goes on the node edit form. If the position is 10 and the user has "administer nodes" permission, it will be added into the "Workflow options."') . '</p>',
);
$form['node']['weight_label'] = array(
'#type' => 'textfield',
'#maxlength' => 64,
'#size' => 64,
'#title' => t('Weight field set label'),
'#default_value' => variable_get('weight_label', t('Node Weight')),
'#description' => '<p>' . t('This determines the legend that is used on the field set. (Maximum length is 64 characters.)') . '</p>',
);
$form['weight_node_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Display On'),
'#default_value' => variable_get('weight_node_types', $types),
'#options' => $types,
'#description' => '<p>' . t('Select the content types to be weighted.
The selected content types will be mass updated to the default weight</p>
<p><i>Note:</i> Unselecting a node type after having changed weights
will result in the loss of those weights. You may want to check the
<a href="@posts_page">content page</a> before unsetting any node types.', array(
'@posts_page' => url('admin/content/node'),
)) . '</p>',
'#attributes' => array(
'class' => 'container-inline',
),
);
$form['weight_default'] = array(
'#type' => 'weight',
'#delta' => variable_get('weight_range', 20),
'#title' => t('Default weight'),
'#default_value' => variable_get('weight_default', 0),
'#description' => t('If a new content type is selected, this is the weight that will be assigned to those nodes. If you are also changing the range above, "Save" that change first.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}