function content_theme_admin_content_node in Content Theme 7
Same name and namespace in other branches
- 6 content_theme.admin.inc \content_theme_admin_content_node()
- 7.2 content_theme.admin.inc \content_theme_admin_content_node()
Menu callback; configures content node themes.
1 string reference to 'content_theme_admin_content_node'
- content_theme_menu in ./
content_theme.module - Implements hook_menu().
File
- ./
content_theme.admin.inc, line 12 - Admin page callbacks for the content_theme module.
Code
function content_theme_admin_content_node($form, &$form_state) {
$destination = drupal_get_destination();
$options = array();
$header = array();
$header['title'] = array(
'data' => t('Title'),
'field' => 'n.title',
);
$header['type'] = array(
'data' => t('Type'),
'field' => 'n.type',
);
$header['changed'] = array(
'data' => t('Updated'),
'field' => 'n.changed',
'sort' => 'desc',
);
$header['edit_theme'] = t('Editing theme');
$header['view_theme'] = t('Viewing theme');
$header['op'] = t('Operations');
$query = db_select('node', 'n')
->extend('PagerDefault')
->extend('TableSort')
->fields('n', array(
'nid',
'title',
'type',
'changed',
))
->limit(50)
->orderByHeader($header)
->execute();
foreach ($query as $result) {
$theme = db_query('SELECT theme FROM {content_theme_node} WHERE nid = :nid AND action = :action', array(
':nid' => $result->nid,
':action' => 'edit',
))
->fetchField();
$edit_theme = $theme !== FALSE ? $theme : '-content_type-';
$theme = db_query('SELECT theme FROM {content_theme_node} WHERE nid = :nid AND action = :action', array(
':nid' => $result->nid,
':action' => 'view',
))
->fetchField();
$view_theme = $theme !== FALSE ? $theme : '-content_type-';
$row = array();
$row['title'] = array(
'data' => array(
'#type' => 'link',
'#title' => $result->title,
'#href' => 'node/' . $result->nid,
),
);
$row['type'] = check_plain(node_type_get_name($result));
$row['changed'] = format_date($result->changed, 'short');
$row['edit_theme'] = content_theme_get_theme_name($edit_theme);
$row['view_theme'] = content_theme_get_theme_name($view_theme);
$row['op'] = array(
'data' => array(
'#type' => 'link',
'#title' => t('edit'),
'#href' => 'node/' . $result->nid . '/edit',
'#options' => array(
'query' => $destination,
),
),
);
$options[$result->nid] = $row;
}
$form['update'] = array(
'#type' => 'fieldset',
'#title' => t('Update content node themes'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['update']['content_theme_edit'] = array(
'#type' => 'select',
'#title' => t('Editing theme'),
'#description' => t('Choose which theme the content creating and editing pages should display in. Content wide theme: %content_wide_theme; system default theme: %system_default_theme.', array(
'%content_wide_theme' => content_theme_get_info_theme_name('content_wide', 'edit'),
'%system_default_theme' => content_theme_get_info_theme_name(),
)),
'#default_value' => '-no_update-',
'#options' => array(
'-no_update-' => '<' . t('No update') . '>',
) + content_theme_get_content_node_options(),
);
$form['update']['content_theme_view'] = array(
'#type' => 'select',
'#title' => t('Viewing theme'),
'#description' => t('Choose which theme the content viewing pages should display in. Content wide theme: %content_wide_theme; system default theme: %system_default_theme.', array(
'%content_wide_theme' => content_theme_get_info_theme_name('content_wide', 'view'),
'%system_default_theme' => content_theme_get_info_theme_name(),
)),
'#default_value' => '-no_update-',
'#options' => array(
'-no_update-' => '<' . t('No update') . '>',
) + content_theme_get_content_node_options(),
);
$form['update']['actions'] = array(
'#type' => 'actions',
);
$form['update']['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update themes'),
);
$form['nodes'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
'#empty' => t('No content nodes available.'),
);
$form['pager'] = array(
'#markup' => theme('pager'),
);
return $form;
}