Commit 28b1d530 authored by Nicholas Thompson's avatar Nicholas Thompson
Browse files

Moving admin pages into separate include

parent 95f31616
<?php
/**
* Displays the form for the standard settings tab.
*
* @return
* array A structured array for use with Forms API.
*/
function page_title_admin_settings() {
//Define the titles
$form['title']['page_title_default'] = array('#type' => 'markup', '#value' => 'Default Pattern');
$form['title']['page_title_front'] = array('#type' => 'markup', '#value' => 'Frontpage Pattern');
//Define the 'default' token patterns
$form['pattern']['page_title_default'] = array('#type' => 'textfield', '#default_value' => variable_get('page_title_default', '[page-title] | [site-name]'), '#maxlength' => 128, '#description' => t('This is the pattern used in a situation where a pattern is not defined specifically for a content type below.'));
$form['pattern']['page_title_front'] = array('#type' => 'textfield', '#default_value' => variable_get('page_title_front', '[site-name] | [site-slogan]'), '#maxlength' => 128, '#description' => t('This is the frontpage pattern.'));
//Definate the patterns per-node-type
$types = node_get_types();
foreach ($types as $type) {
$key = 'page_title_type_'. $type->type;
$form['title'][$key] = array('#type' => 'markup', '#value' => t('Pattern for %type', array('%type' => $type->name)), );
$form['pattern'][$key] = array('#type' => 'textfield', '#default_value' => variable_get($key, ''), '#maxlength' => 128, '#description' => t('If left blank, will inherit from default settings.'));
}
//Add the system buttons to the form
$form = system_settings_form($form);
//Overide the theme function back to our own one
$form['#theme'] = 'page_title_admin_settings';
return $form;
}
/**
* Displays the form for the "Content creation types" tab.
*
* @return
* array A structured form array for use with Forms API.
*/
function page_title_admin_types() {
$form['page_title_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Content creation forms'),
'#description' => t('Display a "Page title" field for these content types.'),
);
$form['page_title_fieldset']['page_title_display'] = array(
'#type' => 'checkboxes',
'#default_value' => variable_get('page_title_display', array()),
'#options' => node_get_types('names'),
);
// Add save button, etc to the form.
return system_settings_form($form);
}
......@@ -61,6 +61,7 @@ function page_title_menu() {
'access callback' => 'user_access',
'access arguments' => array('administer page titles'),
'type' => MENU_NORMAL_ITEM,
'file' => 'page_title.admin.inc',
);
$items['admin/content/page_title/settings'] = array(
'title' => 'Default settings',
......@@ -68,6 +69,7 @@ function page_title_menu() {
'access callback' => 'user_access',
'access arguments' => array('administer page titles'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'file' => 'page_title.admin.inc',
'weight' => -10,
);
$items['admin/content/page_title/types'] = array(
......@@ -77,6 +79,7 @@ function page_title_menu() {
'page arguments' => array('page_title_admin_types'),
'access callback' => 'user_access',
'access arguments' => array('administer page titles'),
'file' => 'page_title.admin.inc',
'type' => MENU_LOCAL_TASK,
);
......@@ -101,62 +104,6 @@ function page_title_theme() {
}
/**
* Displays the form for the standard settings tab.
*
* @return
* array A structured array for use with Forms API.
*/
function page_title_admin_settings() {
//Define the titles
$form['title']['page_title_default'] = array('#type' => 'markup', '#value' => 'Default Pattern');
$form['title']['page_title_front'] = array('#type' => 'markup', '#value' => 'Frontpage Pattern');
//Define the 'default' token patterns
$form['pattern']['page_title_default'] = array('#type' => 'textfield', '#default_value' => variable_get('page_title_default', '[page-title] | [site-name]'), '#maxlength' => 128, '#description' => t('This is the pattern used in a situation where a pattern is not defined specifically for a content type below.'));
$form['pattern']['page_title_front'] = array('#type' => 'textfield', '#default_value' => variable_get('page_title_front', '[site-name] | [site-slogan]'), '#maxlength' => 128, '#description' => t('This is the frontpage pattern.'));
//Definate the patterns per-node-type
$types = node_get_types();
foreach ($types as $type) {
$key = 'page_title_type_'. $type->type;
$form['title'][$key] = array('#type' => 'markup', '#value' => t('Pattern for %type', array('%type' => $type->name)), );
$form['pattern'][$key] = array('#type' => 'textfield', '#default_value' => variable_get($key, ''), '#maxlength' => 128, '#description' => t('If left blank, will inherit from default settings.'));
}
//Add the system buttons to the form
$form = system_settings_form($form);
//Overide the theme function back to our own one
$form['#theme'] = 'page_title_admin_settings';
return $form;
}
/**
* Displays the form for the "Content creation types" tab.
*
* @return
* array A structured form array for use with Forms API.
*/
function page_title_admin_types() {
$form['page_title_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Content creation forms'),
'#description' => t('Display a "Page title" field for these content types.'),
);
$form['page_title_fieldset']['page_title_display'] = array(
'#type' => 'checkboxes',
'#default_value' => variable_get('page_title_display', array()),
'#options' => node_get_types('names'),
);
// Add save button, etc to the form.
return system_settings_form($form);
}
/**
* Implementation of hook_node_type().
*
......
<?php
function _phptemplate_variables($hook, $vars) {
$vars = array();
if ($hook == 'page') {
if (module_exists('page_title')) {
$vars['head_title'] = page_title_page_get_title();
}
}
return $vars;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment