View source
<?php
function themekey_ui_theme() {
return array(
'themekey_ui_table' => array(
'arguments' => array(
'form' => NULL,
),
),
);
}
function themekey_ui_perm() {
return array(
'assign node themes',
);
}
function themekey_ui_menu() {
$items = array();
$items['admin/settings/themekey/settings/ui'] = array(
'title' => 'User Interface',
'access callback' => 'user_access',
'access arguments' => array(
'administer themekey settings',
),
'file' => 'themekey_ui_admin.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'_themekey_ui_settings_form',
),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
return $items;
}
function themekey_ui_form_alter(&$form, $form_state, $form_id) {
if (variable_get('themekey_ui_nodeform', 0) && user_access('assign node themes')) {
$type = isset($form['type']['#value']) ? $form['type']['#value'] : FALSE;
if ($form_id == $type . '_node_form' && variable_get('themekey_ui_nodeform|' . $type, 1)) {
require_once drupal_get_path('module', 'themekey_ui') . '/themekey_ui_admin.inc';
_themekey_ui_nodeform($form, $form_state);
}
}
if ($form_id == 'path_admin_form' && variable_get('themekey_ui_pathalias', 0)) {
require_once drupal_get_path('module', 'themekey_ui') . '/themekey_ui_admin.inc';
_themekey_ui_pathalias($form, $form_state);
}
if ($form_id == 'views_ui_edit_display_form' && $form_state['#section'] == 'page-path' && variable_get('themekey_ui_views', 0) && user_access('administer views')) {
require_once drupal_get_path('module', 'themekey_ui') . '/themekey_ui_admin.inc';
_themekey_ui_views($form, $form_state);
}
}
function themekey_ui_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if (variable_get('themekey_ui_nodeform', 0) && user_access('assign node themes') && variable_get('themekey_ui_nodeform|' . $node->type, 1)) {
require_once drupal_get_path('module', 'themekey_ui') . '/themekey_ui_admin.inc';
_themekey_ui_nodeapi($node, $op, $a3, $a4);
}
}
function themekey_ui_form_submit($form, &$form_state) {
if (isset($form_state['values']['themekey_submit'])) {
require_once drupal_get_path('module', 'themekey_ui') . '/themekey_ui_admin.inc';
$handler = $form_state['values']['themekey_submit'];
if (function_exists($handler)) {
$handler($form, $form_state);
}
}
}