function mostpopular_settings_form in Drupal Most Popular 6
Same name and namespace in other branches
- 7 mostpopular.admin.inc \mostpopular_settings_form()
1 string reference to 'mostpopular_settings_form'
- mostpopular_menu in ./
mostpopular.module - Implements hook_menu().
File
- ./
mostpopular.admin.inc, line 22 - Defines all the administration forms for the Most Popular module.
Code
function mostpopular_settings_form() {
$form = array();
$form['mostpopular_max'] = array(
'#type' => 'textfield',
'#title' => t('Max Results'),
'#description' => t('The maximum number of results to show in the Most Popular block'),
'#size' => 2,
'#default_value' => variable_get('mostpopular_max', 5),
);
$form['block'] = array(
'#type' => 'fieldset',
'#collapsible' => true,
'#title' => t('Block settings'),
'#description' => t('Configure the look and feel of the Most Popular block.'),
);
$form['block']['mostpopular_show_count'] = array(
'#type' => 'checkbox',
'#title' => t('Show item counts'),
'#description' => t('Should the number of times each item appears be displayed in the Most Popular block?'),
'#default_value' => variable_get('mostpopular_show_count', TRUE),
);
$form['block']['mostpopular_styling'] = array(
'#type' => 'radios',
'#title' => t('Stylesheet'),
'#description' => '<p>' . t("Choose how much styling to apply to the Most Popular block.\nYou can add additional styling in your own theme.") . '</p>' . '<p>' . t("For help, look at the <a href='@basic'>basic stylesheet</a>, which turns the\nservice and interval links into tabs, and the <a href='@full'>full stylesheet</a>,\nwhich adds fonts, colors, formatting, and layouts.", array(
'@basic' => url(drupal_get_path('module', 'mostpopular') . '/css/mostpopular-basic.css'),
'@full' => url(drupal_get_path('module', 'mostpopular') . '/css/mostpopular-full.css'),
)) . '</p>' . '<p>' . t("When creating your own styles for the Most Popular block, we recommend you\nstart with our full stylesheet and override it using drupal_set_css().") . '</p>',
'#options' => array(
MOSTPOPULAR_STYLE_NONE => t('No styling'),
MOSTPOPULAR_STYLE_BASIC => t('Basic styling'),
MOSTPOPULAR_STYLE_FULL => t('Full styling'),
),
'#default_value' => variable_get('mostpopular_styling', MOSTPOPULAR_STYLE_FULL),
);
// Add a fieldset for configuring Drupal paths
$form['paths'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => t('Drupal Paths'),
);
// Get the configured base paths
$site_base = url('', array(
'absolute' => TRUE,
));
$path_base = url('');
$basepaths = variable_get('mostpopular_basepaths', array(
$site_base,
$path_base,
));
$form['paths']['mostpopular_basepaths'] = array(
'#type' => 'textarea',
'#rows' => 6,
'#title' => t('Base Paths'),
'#default_value' => implode("\n", $basepaths),
'#description' => t("<p>These base URLs will be stripped from the beginning of any full page URLs returned\nby the various services. This allows the most popular content to work across several\nsite configurations. This will only work, however, if the node nids are shared\nbetween all sites.</p>\n<p>Put each base URL on a separate line. Each must end with a slash.</p>"),
);
// Get the configured exclude paths
$excludepaths = variable_get('mostpopular_exclude_paths', array());
$form['paths']['mostpopular_exclude_paths'] = array(
'#type' => 'textarea',
'#rows' => 10,
'#title' => t('Paths to exclude'),
'#default_value' => implode("\n", $excludepaths),
'#description' => t("<p>These Drupal pages will be excluded from the most popular results for any\nservices that return nodes. The homepage will automatically be excluded, but\nyou can use this field to hide landing pages or other non-content pages.</p>\n<p>Each URL should be an internal Drupal path with no leading slash, and can\npoint either to node/%d or to an alias. Put each path on a separate line.</p>"),
);
$form['#submit'][] = 'mostpopular_settings_form_submit';
$form = system_settings_form($form);
return $form;
}