| 1 |
<?php
|
| 2 |
//$Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Settings form.
|
| 6 |
*/
|
| 7 |
function category_admin_settings() {
|
| 8 |
$form = array();
|
| 9 |
// select options
|
| 10 |
$distant = array(
|
| 11 |
'0' => t('None'),
|
| 12 |
'1' => t('One'),
|
| 13 |
'2' => t('Multiple'),
|
| 14 |
);
|
| 15 |
|
| 16 |
// Wrapper settings
|
| 17 |
/* $form['wrappers'] = array(
|
| 18 |
'#type' => 'fieldset',
|
| 19 |
'#title' => t('Wrapper install / uninstall settings'),
|
| 20 |
'#collapsible' => TRUE,
|
| 21 |
'#collapsed' => FALSE,
|
| 22 |
);
|
| 23 |
$book_status = category_get_wrapper_status('book');
|
| 24 |
$taxonomy_status = category_get_wrapper_status('taxonomy');
|
| 25 |
$form['wrappers']['book_wrapper'] = array(
|
| 26 |
'#type' => 'item',
|
| 27 |
'#title' => t('Book wrapper status'),
|
| 28 |
'#value' => theme('category_wrapper_status', 'book', $book_status),
|
| 29 |
);
|
| 30 |
$form['wrappers']['taxonomy_wrapper'] = array(
|
| 31 |
'#type' => 'item',
|
| 32 |
'#title' => t('Taxonomy wrapper status'),
|
| 33 |
'#value' => theme('category_wrapper_status', 'taxonomy', $taxonomy_status),
|
| 34 |
'#description' => '<p>'. t('You can install and uninstall the taxonomy and book wrapper modules using the links below. It is very important that you have taxonomy or book (original or wrapper, whichever is installed) <strong>enabled</strong> on the <a href="@module-admin-page">module administration page</a> before performing an install or uninstall. Additionally, you should make sure that your web server has write permission on the file system, or the scripts may be denied access to copy and rename the necessary files.', array('@module-admin-page' => url('admin/build/modules'))) .'</p>'
|
| 35 |
.'<p>'. t('When performing an install, the scripts will rename your existing taxonomy or book module file to <code>modulename.module.old</code>. It will then copy the appropriate <code>modulename.module.copyme</code> file from the <code>wrappers/</code> directory (in your category package) to the location where the old module file was, and will rename the copied file to <code>modulename.module</code>. The reverse will happen when performing an uninstall. The script will determine the correct location of all necessary files automatically, based on the existing locations of those files.') .'</p>'
|
| 36 |
.'<p>'. t('After the operation that you invoke is completed, you will be returned to this page.') .'</p>',
|
| 37 |
);
|
| 38 |
*/
|
| 39 |
// Node type settings
|
| 40 |
$form['nodetype'] = array(
|
| 41 |
'#type' => 'fieldset',
|
| 42 |
'#title' => t('Content type settings'),
|
| 43 |
'#collapsible' => TRUE,
|
| 44 |
'#collapsed' => TRUE,
|
| 45 |
);
|
| 46 |
$form['nodetype']['category_allow_nodetypes'] = array(
|
| 47 |
'#type' => 'checkboxes',
|
| 48 |
'#title' => t('Allow other content types to be'),
|
| 49 |
'#default_value' => variable_get('category_allow_nodetypes', array('category_cat' => 0, 'category_cont' => 0)),
|
| 50 |
'#options' => array('category_cat' => t('Categories'), 'category_cont' => t('Containers')),
|
| 51 |
'#description' => t('Allows category or container behavior to be assigned to other content types. When enabled, each content type (except for category and container) receives a new setting allowing it to be a category or a container. When switched on for a particular content type, all nodes of that type receive the new behavior.')
|
| 52 |
);
|
| 53 |
// Replace the below with "Add / delete default cat/cont type" buttons
|
| 54 |
/*
|
| 55 |
$form['nodetype']['category_base_nodetypes'] = array(
|
| 56 |
'#type' => 'checkboxes',
|
| 57 |
'#title' => t('Provide these content types'),
|
| 58 |
'#default_value' => variable_get('category_base_nodetypes', array('category_cat' => 'category_cat', 'category_cont' => 'category_cont')),
|
| 59 |
'#options' => array('category_cat' => t('Category'), 'category_cont' => t('Container')),
|
| 60 |
'#description' => t('Provides a built-in content type for creating categories, and a built-in content type for creating containers. Do not disable either of these unless you have allowed other content types to be categories or containers, and you have set other content types to have category or container behavior; otherwise, you will have not be able to create categories or containers.')
|
| 61 |
);
|
| 62 |
*/
|
| 63 |
|
| 64 |
// Distant parent settings
|
| 65 |
$form['distant'] = array(
|
| 66 |
'#type' => 'fieldset',
|
| 67 |
'#title' => t('Distant parent settings'),
|
| 68 |
'#collapsible' => TRUE,
|
| 69 |
'#collapsed' => TRUE,
|
| 70 |
);
|
| 71 |
$form['distant']['category_distant_containers'] = array(
|
| 72 |
'#type' => 'radios',
|
| 73 |
'#title' => t('Number of parents that a container can have'),
|
| 74 |
'#default_value' => variable_get('category_distant_containers', 1),
|
| 75 |
'#options' => $distant,
|
| 76 |
'#description' => t("If set to more than zero, this allows your containers to select other containers, or categories, as distant parents. Changing this setting does not affect your existing containers; unless you change it from 'one' or 'multiple' to 'zero', and you then manually update an individual container, in which case all distant parent relationships for that container will be lost. This setting does not affect distant parent relationships for categories: these are managed separately within each container."),
|
| 77 |
);
|
| 78 |
|
| 79 |
// Allow other modules to add additional settings.
|
| 80 |
$extra = module_invoke_all('category', 'settings');
|
| 81 |
if (isset($extra) && is_array($extra)) {
|
| 82 |
foreach ($extra as $key => $value) {
|
| 83 |
$form[$key] = $value;
|
| 84 |
}
|
| 85 |
}
|
| 86 |
|
| 87 |
$form['buttons']['#weight'] = 10;
|
| 88 |
|
| 89 |
return system_settings_form($form);
|
| 90 |
}
|