function total_control_add_content_pane_settings in Total Control Admin Dashboard 7.2
Same name and namespace in other branches
- 6.2 includes/total_control.inc \total_control_add_content_pane_settings()
Adds content settings to the panel pane config form.
Parameters
$form: Panel pane config form.
$conf: Panel content pane config data.
2 calls to total_control_add_content_pane_settings()
- total_control_overview_content_content_type_edit_form in plugins/
content_types/ overview_content.inc - 'Edit form' callback for the content type.
- total_control_overview_content_type_edit_form in plugins/
content_types/ overview.inc - 'Edit form' callback for the content type.
File
- includes/
total_control.inc, line 339 - Helper functions for total control.
Code
function total_control_add_content_pane_settings(&$form, $conf = array()) {
$types = node_type_get_types();
$type_options = array();
$type_defaults = array();
$comment_defaults = array();
// Set defaults based on pane config.
if (isset($conf['types'])) {
$type_defaults = $conf['types'];
}
if (isset($conf['comments'])) {
$comment_defaults = $conf['comments'];
}
foreach ($types as $machine_type => $type) {
$type_options[$machine_type] = $type->name;
// Display new content types by default.
if (!array_key_exists($machine_type, $type_defaults)) {
$type_defaults[$machine_type] = $machine_type;
}
// Do not display comments on new types by default unless it's a blog or a forum.
if (!array_key_exists($machine_type, $comment_defaults)) {
if ($machine_type == 'blog' || $machine_type == 'forum topic') {
$comment_defaults[$machine_type] = $machine_type;
}
else {
$comment_defaults[$machine_type] = 0;
}
}
}
$form['types'] = array(
'#type' => 'checkboxes',
'#title' => t('Show <strong>post</strong> counts for the following content types'),
'#options' => $type_options,
'#default_value' => $type_defaults,
);
if (module_exists('comment')) {
$form['comments'] = array(
'#type' => 'checkboxes',
'#title' => t('Show <strong>comment</strong> counts for the following content types'),
'#options' => $type_options,
'#default_value' => $comment_defaults,
);
$spam_options = array(
0 => t('no'),
1 => t('Include spam counts with comments'),
);
$form['spam'] = array(
'#type' => 'checkbox',
'#title' => t('Include spam counts with comments'),
'#options' => $spam_options,
'#default_value' => $form_state['op'] == 'add' ? 1 : $conf['spam'],
);
}
}