summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-10-11 19:44:35 +0000
committerDries Buytaert <dries@buytaert.net>2005-10-11 19:44:35 +0000
commit75fe6b6c0ae85d2b53cb803d5b028b050fd6d454 (patch)
tree70ea02551300ed5a696b4d289cfc4722924d58ca
parentecf5ed57d66a182ae0e269942169e0a6cf3a3912 (diff)
downloadbrdo-75fe6b6c0ae85d2b53cb803d5b028b050fd6d454.tar.gz
brdo-75fe6b6c0ae85d2b53cb803d5b028b050fd6d454.tar.bz2
- Patch #33752 by chx, adrian, et al: another batch of form API changes/fixes.
-rw-r--r--includes/form.inc617
-rw-r--r--includes/locale.inc72
-rw-r--r--includes/unicode.inc2
-rw-r--r--modules/aggregator.module80
-rw-r--r--modules/aggregator/aggregator.module80
-rw-r--r--modules/block.module108
-rw-r--r--modules/block/block.module108
-rw-r--r--modules/blog.module12
-rw-r--r--modules/blog/blog.module12
-rw-r--r--modules/blogapi.module12
-rw-r--r--modules/blogapi/blogapi.module12
-rw-r--r--modules/book.module56
-rw-r--r--modules/book/book.module56
-rw-r--r--modules/comment.module102
-rw-r--r--modules/comment/comment.module102
-rw-r--r--modules/contact.module50
-rw-r--r--modules/contact/contact.module50
-rw-r--r--modules/drupal.module8
-rw-r--r--modules/drupal/drupal.module8
-rw-r--r--modules/filter.module82
-rw-r--r--modules/filter/filter.module82
-rw-r--r--modules/forum.module60
-rw-r--r--modules/forum/forum.module60
-rw-r--r--modules/locale.module4
-rw-r--r--modules/locale/locale.module4
-rw-r--r--modules/menu.module46
-rw-r--r--modules/menu/menu.module46
-rw-r--r--modules/node.module145
-rw-r--r--modules/node/node.module145
-rw-r--r--modules/page.module12
-rw-r--r--modules/page/page.module12
-rw-r--r--modules/path.module14
-rw-r--r--modules/path/path.module14
-rw-r--r--modules/poll.module28
-rw-r--r--modules/poll/poll.module28
-rw-r--r--modules/profile.module44
-rw-r--r--modules/profile/profile.module44
-rw-r--r--modules/search.module26
-rw-r--r--modules/search/search.module26
-rw-r--r--modules/statistics.module18
-rw-r--r--modules/statistics/statistics.module18
-rw-r--r--modules/story.module12
-rw-r--r--modules/story/story.module12
-rw-r--r--modules/system.module336
-rw-r--r--modules/system/system.module336
-rw-r--r--modules/taxonomy.module89
-rw-r--r--modules/taxonomy/taxonomy.module89
-rw-r--r--modules/throttle.module34
-rw-r--r--modules/throttle/throttle.module34
-rw-r--r--modules/upload.module54
-rw-r--r--modules/upload/upload.module54
-rw-r--r--modules/user.module170
-rw-r--r--modules/user/user.module170
-rw-r--r--modules/watchdog.module10
-rw-r--r--modules/watchdog/watchdog.module10
55 files changed, 1804 insertions, 2111 deletions
diff --git a/includes/form.inc b/includes/form.inc
index fa7e56368..2074d6e51 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -10,319 +10,10 @@
*/
/**
- * Form property constants.
- *
- * These constants are defined to keep the namespace of the form tree available for elements.
- * Properties are strings that start with '_' (underscore) and have special meaning for the form api.
- */
-
-/**
- * Keyword: type.
- * Required: true
- * Description: Used to specify the form element type. Form elements are defined by implementation of hook_elements.
- */
-define('type', '_type');
-
-define('theme', '_theme');
-
-define('theme_used', '_theme_used');
-/**
- * Keyword: name.
- * Internal: For use within the form api. Should not be set by the developer.
- * Description: The form_builder function populates this property based on the location of the form element in the form tree.
- */
-define('name', '_name');
-
-/**
- * Keyword: id.
- * Internal: For use within the form api. Should not be set by the developer.
- * Description: The form_builder function populates this property based on the location of the form element in the form tree.
- * This is used for the form_set_error notification, along with the stylesheets to be used.
- */
-define('id', '_id');
-
-/**
- * Keyword: printed
- * Internal: For use within the form api. Should not be set by the developer.
- * Description: Used by form_render to ascertain wether or not a form element has been printed yet
- */
-define('printed', '_printed');
-
-/**
- * Keyword: built
- * Internal: For use within the form api. Should not be set by the developer.
- * Description: Used by _form_builder to ascertain wether or not a form element has been built yet
- */
-define('built', '_built');
-
-/**
- * Keyword: processed
- * Internal: For use within the form api. Should not be set by the developer.
- * Description: Used by _form_builder to ascertain wether or not a form element has been processed (ie: expanded to multiple elements)
- */
-define('processed', '_processed');
-
-
-/**
- * Keyword: variable
- * Internal: For use within the form api. Should not be set by the developer.
- * Description: used by form builder to populate a global form_variables array.
- */
-define('variable', '_variable');
-
-/**
- * Keyword: id.
- * Internal: For use within the form api. Should not be set by the developer.
- * Description: The form_builder function uses this property to keep track of the parent form elements, and uses this to generate the id and name properties.
- */
-define('parents', '_parents');
-
-/**
- * Keyword: input.
- * Description: Wether or not an input is possible for this form element. True / False. Set in the hook_elements implementation.
- */
-define('input', '_input');
-
-/**
- * Keyword: validated.
- * Description: Wether or not an input has been validated.
- */
-define('validated', '_validated');
-
-/**
- * Keyword: value.
- * Used: For all form elements except 'textarea' and the 'default' fallback.
- * Description: The value the form element should be set as. Setting this yourself is not required, although it might be a good idea for form elements that
- * don't change. See the default_value property.
- */
-define('value', '_value');
-
-/**
- * Keyword: default_value.
- * Used: For all form elements that have a value property.
- * Description: The value the form element should be initialized as. If no submission for this element exists, the element will be set to this value.
- * This means that you do not have to set the value properties for form elements, as they will be automatically handled by the form api.
- */
-define('default_value', '_default_value');
-
-/**
- * Keyword: return_value.
- * Used: For select , radio and checkbox elements.
- * Description: The value the form element will return.
- */
-define('return_value', '_return_value');
-
-/**
- * Keyword: title
- * Used: For all form elements that have visible output.
- * Description: The title of the form element. The developer should use the t() function to translate this property.
- */
-define('title', '_title');
-
-/**
- * Keyword: description
- * Used: For all form elements that have visible output.
- * Description: The description of the form element. The developer should use the t() function to translate this property.
- */
-define('description', '_description');
-
-/**
- * Keyword: required
- * Used: For all form elements that have visible output.
- * Description: Wether or not the element is required. This automatically validates for empty fields, and flags inputs as required.
- */
-define('required', '_required');
-
-/**
- * Keyword: cols
- * Used: textarea elements.
- * Description: How many columns wide the textarea should be.
- */
-define('cols', '_cols');
-
-/**
- * Keyword: rows
- * Used: textarea elements.
- * Description: How many rows high the textarea should be.
- */
-define('rows', '_rows');
-
-/**
- * Keyword: size
- * Used: textfield elements.
- * Description: How many characters wide should the textfield be.
- */
-define('size', '_size');
-
-/**
- * Keyword: maxlength
- * Used: For textfield element types.
- * Description: The maximum amount of characters to accept as input.
- */
-define('maxlength', '_maxlength');
-
-/**
- * Keyword: valid
- * Used: For all form elements that have the value property.
- * Description: A list of validation functions that need to be passed.
- */
-define('valid', '_valid');
-define('validation_arguments', '_validation_arguments');
-
-/**
- * Keyword: weight
- * Used: all elements.
- * Description: Used by the form_render function to sort the list of elements before being output.
- */
-define('weight', '_weight');
-
-/**
- * Keyword: collapsible
- * Used: fieldset elements.
- * Description: Wether or not the fieldset can be collapsed with javascript.
- */
-define('collapsible', '_collapsible');
-
-/**
- * Keyword: collapsed
- * Used: fieldset elements.
- * Description: Wether or not the fieldset is collapsed by default. See collapsible property.
- */
-define('collapsed', '_collapsed');
-
-/**
- * Keyword: autocomplete_path
- * Used: textfield elements.
- * Description: The path the AJAX autocomplete script uses as the source for autocompletion.
- */
-define('autocomplete_path', '_autocomplete_path');
-
-/**
- * Keyword: action
- * Used: form elements.
- * Description: The path to which the form will be submitted.
- */
-define('action', '_action');
-
-/**
- * Keyword: method
- * Used: form elements.
- * Description: The HTTP method the form will be submitted with (GET/POST). Default is 'post'.
- */
-define('method', '_method');
-
-/**
- * Keyword: attributes
- * Used: all visible form elements.
- * Description: Additional html attributes, such as 'class' can be set using this mechanism.
- */
-define('attributes', '_attributes');
-
-/**
- * Keyword: options
- * Used: select boxes, checkboxes and radios form elements.
- * Description: An associative array containing the options to be used. In the format 'return_value' => 'Display Value'
- *
- * It is possible to group options together; to do this, change the format of
- * $options to an associative array in which the keys are group labels, and the
- * values are associative arrays in the normal $options format.
- */
-define('options', '_options');
-
-/**
- * Keyword: extra
- * Used: select boxes.
- * Description: Additional HTML to inject into the select element tag.
- */
-define('extra', '_extra');
-
-/**
- * Keyword: multiple
- * Used: select boxes.
- * Description: Wether the user may select more than one item.
- */
-define('multiple', '_multiple');
-
-/**
- * Keyword: button_type
- * Used: buttons.
- * Description: The type of button to display (cancel or submit)
- */
-define('button_type', '_button_type');
-
-
-
-/**
- * Keyword: error
- * Used: All visible form elements.
- * Description: Wether or not a form element has been flagged as having an error.
- */
-define('error', '_error');
-
-/**
- * Keyword: prefix
- * Used: markup element.
- * Description: Text to include before the value and children properties.
- */
-define('prefix', '_prefix');
-
-/**
- * Keyword: suffix
- * Used: markup element.
- * Description: Text to include after the value and children properties.
- */
-define('suffix', '_suffix');
-
-/**
- * Keyword: error
- * Used: weight form element.
- * Description: Number of weights to have selectable.
- */
-define('delta', '_delta');
-
-/**
- * Multiple elements. For use in the poll module, and for file uploads.
- */
-
-/**
- * Keyword : process
- * Used : By any element, used to modify a form element.
- */
-define('process', '_process');
-
-/**
- * Keyword: multiple
- */
-define('multiple', '_multiple');
-
-/**
- * Keyword: min
- */
-define('minimum', '_minimum');
-
-/**
- * Keyword: max
- */
-define('maximum', '_maximum');
-
-/**
- * Keyword: increment
- */
-define('increment', '_increment');
-
-define('spawned', '_spawned');
-
-define('tree', '_tree');
-
-define('token', '_token');
-
-define('execute', '_execute');
-
-/**
* Check if the key is a property.
*/
function element_property($key) {
- return (substr($key, 0, 1) == '_');
+ return $key{0} == '#';
}
function element_properties($element) {
@@ -333,7 +24,7 @@ function element_properties($element) {
* Check if the key is a child.
*/
function element_child($key) {
- return (substr($key, 0, 1) != '_');
+ return $key{0} != '#';
}
function element_children($element) {
@@ -358,10 +49,10 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
global $form_values, $form_execute;
$form_values = array();
$form_execute = FALSE;
- $form[type] = 'form';
- $form[attributes]['class'] .= ' form-api';
- if (isset($form[token])) {
- $form['form_token'] = array(type => 'hidden', value => md5($_SERVER['REMOTE_ADDR'] . $form[token] . variable_get('drupal_private_key', '')));
+ $form['#type'] = 'form';
+ $form['#attributes']['class'] .= ' form-api';
+ if (isset($form['#token'])) {
+ $form['form_token'] = array('#type' => 'hidden', '#value' => md5($_SERVER['REMOTE_ADDR'] . $form['#token'] . variable_get('drupal_private_key', '')));
}
$form = array_merge(_element_info('form'), $form);
@@ -375,18 +66,21 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
$function($form);
}
- if (!$form[built]) {
+ if (!$form['#built']) {
$form = _form_builder($form);
}
- if ($form_execute) {
- drupal_execute_form($form_id, $form, $callback);
+ if (!empty($_POST['edit'])) {
+ drupal_validate_form($form_id, $form, $callback);
+ if ($form_execute && !form_get_errors()) {
+ drupal_execute_form($form_id, $form, $callback);
+ }
}
if (function_exists('theme_' . $form_id)) {
- $form[theme] = $form_id;
+ $form['#theme'] = $form_id;
}
elseif (function_exists('theme_' . $callback)) {
- $form[theme] = $callback;
+ $form['#theme'] = $callback;
}
return form_render($form);
}
@@ -394,8 +88,8 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
function drupal_validate_form($form_id, &$form, $callback = NULL) {
global $form_values;
- if (isset($form[token])) {
- if ($form_values['form_token'] != md5($_SERVER['REMOTE_ADDR'] . $form[token] . variable_get('drupal_private_key', ''))) {
+ if (isset($form['#token'])) {
+ if ($form_values['form_token'] != md5($_SERVER['REMOTE_ADDR'] . $form['#token'] . variable_get('drupal_private_key', ''))) {
// setting this error will cause the form to fail validation
form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
}
@@ -418,21 +112,16 @@ function drupal_validate_form($form_id, &$form, $callback = NULL) {
function drupal_execute_form($form_id, $form, $callback = NULL) {
global $form_values;
- if (!empty($_POST['edit'])) {
- drupal_validate_form($form_id, $form, $callback);
- if (!form_get_errors()) {
- foreach (module_implements('form_execute_alter') as $module) {
- $function = $module .'_form_execute_alter';
- $function($form_id, $form_values);
- }
+ foreach (module_implements('form_execute_alter') as $module) {
+ $function = $module .'_form_execute_alter';
+ $function($form_id, $form_values);
+ }
- if (function_exists($form_id . '_execute')) {
- call_user_func($form_id . '_execute', $form_id, $form_values);
- }
- elseif (function_exists($callback . '_execute')) {
- call_user_func($callback . '_execute', $form_id, $form_values);
- }
- }
+ if (function_exists($form_id . '_execute')) {
+ call_user_func($form_id . '_execute', $form_id, $form_values);
+ }
+ elseif (function_exists($callback . '_execute')) {
+ call_user_func($callback . '_execute', $form_id, $form_values);
}
}
@@ -444,30 +133,27 @@ function _form_validate(&$elements) {
}
/* Validate the current input */
- if (!$elements[validated] && $elements[input]) {
- if ($elements[required]) {
- if (!$elements[value]) {
- form_error($elements, t('%name field is required', array('%name' => $elements[title])));
- }
- if ($elements[valid]) {
- if (is_array($elements[valid])) {
- foreach ($elements[valid] as $key => $valid) {
- $args = is_array($elements[validation_arguments][$key]) ? $elements[validation_arguments][$key] : array();
- if (function_exists('valid_' . $valid)) {
- call_user_func_array('valid_' . $valid, array_merge(array($elements), $args));
- }
+ if (!$elements['#validated'] && $elements['#input']) {
+ if ($elements['#required'] && !$elements['#value']) {
+ form_error($elements, t('%name field is required', array('%name' => $elements['#title'])));
+ }
+ if ($elements['#valid']) {
+ if (is_array($elements['#valid'])) {
+ foreach ($elements['#valid'] as $key => $valid) {
+ $args = is_array($elements['#validation_arguments'][$key]) ? $elements['#validation_arguments'][$key] : array();
+ if (function_exists($valid . '_valid')) {
+ call_user_func_array($valid . '_valid', array_merge(array($elements), $args));
}
}
- else {
- $args = is_array($elements[validation_arguments]) ? $elements[validation_arguments] : array();
- if (function_exists('valid_' . $elements[valid])) {
- call_user_func_array('valid_' . $elements[valid], array_merge(array($elements), $args));
- }
+ }
+ else {
+ $args = is_array($elements['#validation_arguments']) ? $elements['#validation_arguments'] : array();
+ if (function_exists($elements['#valid'] . '_valid')) {
+ call_user_func_array($elements['#valid'] . '_valid', array_merge(array($elements), $args));
}
-
}
}
- $elements[validated] = TRUE;
+ $elements['#validated'] = TRUE;
}
}
@@ -475,8 +161,8 @@ function _form_validate(&$elements) {
* Flag an element as having an error.
*/
function form_error(&$element, $message) {
- $element[error] = TRUE;
- $GLOBALS['form'][$element[name]] = $message;
+ $element['#error'] = TRUE;
+ $GLOBALS['form'][$element['#name']] = $message;
drupal_set_message($message, 'error');
}
@@ -490,56 +176,57 @@ function _form_builder($form, $parents = array(), $multiple = FALSE) {
global $form_values;
global $form_execute;
- if ($form[built] == TRUE) {
+ if ($form['#built'] == TRUE) {
return $form;
}
- $form[built] = TRUE;
+ $form['#built'] = TRUE;
- $form[parents] = ($form[parents]) ? $form[parents] : $parents;
+ $form['#parents'] = ($form['#parents']) ? $form['#parents'] : $parents;
/* Use element defaults */
- if ((!empty($form[type])) && ($info = _element_info($form[type]))) {
+ if ((!empty($form['#type'])) && ($info = _element_info($form['#type']))) {
$form += $info;
}
- if ($form[input]) {
- if (!$form[tree]) {
- $form[parents] = array(array_pop($form[parents]));
+ if ($form['#input']) {
+ if (!$form['#tree']) {
+ $form['#parents'] = array(array_pop($form['#parents']));
}
- $form[name] = ($form[name]) ? $form[name] : 'edit[' . implode('][', $form[parents]) . ']';
- $form[id] = ($form[id]) ? $form[id] : 'edit-' . implode('-', $form[parents]);
+ $form['#name'] = ($form['#name']) ? $form['#name'] : 'edit[' . implode('][', $form['#parents']) . ']';
+ $form['#id'] = ($form['#id']) ? $form['#id'] : 'edit-' . implode('-', $form['#parents']);
$posted = isset($_POST['edit']);
$edit = $posted ? $_POST['edit'] : array();
$ref =& $form_values;
- foreach ($form[parents] as $parent) {
+ foreach ($form['#parents'] as $parent) {
$edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
$ref =& $ref[$parent];
}
- $default_value = $posted ? $edit : $form[default_value];
- $form[value] = isset($form[value]) ? $form[value] : $default_value;
- if (isset($form[execute])) {
- if ($_POST[$form[name]] == $form[value]) {
- $form_execute = $form_execute || $form[execute];
+ if (!isset($form['#value'])) {
+ $form['#value'] = $posted ? $edit : $form['#default_value'];
+ }
+ if (isset($form['#execute'])) {
+ if ($_POST[$form['#name']] == $form['#value']) {
+ $form_execute = $form_execute || $form['#execute'];
}
}
- $ref = $form[value];
+ $ref = $form['#value'];
}
// Allow for elements to expand to multiple elements. Radios, checkboxes and files for instance.
- if (function_exists($form[process]) && !$form[processed]) {
- $form = call_user_func($form[process], $form);
- $form[processed] = TRUE;
+ if (function_exists($form['#process']) && !$form['#processed']) {
+ $form = call_user_func($form['#process'], $form);
+ $form['#processed'] = TRUE;
}
// Recurse through all child elements.
$count = 0;
foreach (element_children($form) as $key) {
- $form[$key][tree] = (isset($form[$key][tree])) ? $form[$key][tree] : $form[tree];
+ $form[$key]['#tree'] = (isset($form[$key]['#tree'])) ? $form[$key]['#tree'] : $form['#tree'];
# Assign a decimal placeholder weight, to preserve original array order
- $form[$key][weight] = $form[$key][weight] ? $form[$key][weight] : $count/10;
- $form[$key] = _form_builder($form[$key], array_merge($form[parents], array($key)));
+ $form[$key]['#weight'] = $form[$key]['#weight'] ? $form[$key]['#weight'] : $count/10;
+ $form[$key] = _form_builder($form[$key], array_merge($form['#parents'], array($key)));
$count++;
}
@@ -564,14 +251,14 @@ function form_render(&$elements) {
uasort($elements, "_form_sort");
}
- if (!$elements[children]) {
+ if (!$elements['#children']) {
/* render all the children using a theme function */
- if ($elements[theme] && !$elements[theme_used]) {
- $elements[theme_used] = TRUE;
- $previous_type = $elements[type];
- $elements[type] = 'markup';
- $content = theme($elements[theme], $elements);
- $elements[type] = $previous_type;
+ if ($elements['#theme'] && !$elements['#theme_used']) {
+ $elements['#theme_used'] = TRUE;
+ $previous_type = $elements['#type'];
+ $elements['#type'] = 'markup';
+ $content = theme($elements['#theme'], $elements);
+ $elements['#type'] = $previous_type;
}
/* render each of the children using form_render and concatenate them */
if (!$content) {
@@ -581,26 +268,28 @@ function form_render(&$elements) {
}
}
if ($content) {
- $elements[children] = $content;
+ $elements['#children'] = $content;
}
/* Call the form element renderer */
- if (!$elements[printed]) {
- $content = theme(($elements[type]) ? $elements[type]: 'markup', $elements);
- $elements[printed] = TRUE;
+ if (!$elements['#printed']) {
+ $content = theme(($elements['#type']) ? $elements['#type']: 'markup', $elements);
+ $elements['#printed'] = TRUE;
}
- return $elements[prefix] . $content . $elements[suffix];
+ if ($content) {
+ return $elements['#prefix'] . $content . $elements['#suffix'];
+ }
}
/**
* Function used by uasort in form render to sort form via weight.
*/
function _form_sort($a, $b) {
- if ($a[weight] == $b[weight]) {
+ if ($a['#weight'] == $b['#weight']) {
return 0;
}
- return ($a[weight] < $b[weight]) ? -1 : 1;
+ return ($a['#weight'] < $b['#weight']) ? -1 : 1;
}
/**
@@ -609,10 +298,10 @@ function _form_sort($a, $b) {
function _element_info($type, $refresh = null) {
static $cache;
$basic_defaults = array(
- description => NULL,
- attributes => array(),
- required => FALSE,
- tree => FALSE
+ '#description' => NULL,
+ '#attributes' => array(),
+ '#required' => FALSE,
+ '#tree' => FALSE
);
if ($refresh || !is_array($cache)) {
$cache = array();
@@ -647,19 +336,19 @@ function _element_info($type, $refresh = null) {
*/
function theme_select($element) {
$select = '';
- foreach ($element[options] as $key => $choice) {
+ foreach ($element['#options'] as $key => $choice) {
if (is_array($choice)) {
$select .= '<optgroup label="'. $key .'">';
foreach ($choice as $key => $choice) {
- $select .= '<option value="'. $key .'"'. (is_array($element[value]) ? (in_array($key, $element[value]) ? ' selected="selected"' : '') : ($element[value] == $key ? ' selected="selected"' : '')) .'>'. check_plain($choice) .'</option>';
+ $select .= '<option value="'. $key .'"'. (is_array($element['#value']) ? (in_array($key, $element['#value']) ? ' selected="selected"' : '') : ($element['#value'] == $key ? ' selected="selected"' : '')) .'>'. check_plain($choice) .'</option>';
}
$select .= '</optgroup>';
}
else {
- $select .= '<option value="'. $key .'"'. (is_array($element[value]) ? (in_array($key, $element[value]) ? ' selected="selected"' : '') : ($element[value] == $key ? ' selected="selected"' : '')) .'>'. check_plain($choice) .'</option>';
+ $select .= '<option value="'. $key .'"'. (is_array($element['#value']) ? (in_array($key, $element['#value']) ? ' selected="selected"' : '') : ($element['#value'] == $key ? ' selected="selected"' : '')) .'>'. check_plain($choice) .'</option>';
}
}
- return theme('form_element', $element[title], '<select name="'. $element[name] .''. ($element[multiple] ? '[]' : '') .'"'. ($element[multiple] ? ' multiple="multiple" ' : '') . ($element[extra] ? ' '. $element[extra] : '') .' id="' . $element[id] .'">'. $select .'</select>', $element[description], $element[name], $element[required], _form_get_error($element[name]));
+ return theme('form_element', $element['#title'], '<select name="'. $element['#name'] .''. ($element['#multiple'] ? '[]' : '') .'"'. ($element['#multiple'] ? ' multiple="multiple" ' : '') . ($element['#extra'] ? ' '. $element['#extra'] : '') .' id="' . $element['#id'] .'">'. $select .'</select>', $element['#description'], $element['#name'], $element['#required'], _form_get_error($element['#name']));
}
/**
@@ -672,16 +361,16 @@ function theme_select($element) {
* A themed HTML string representing the form item group.
*/
function theme_fieldset($element) {
- if ($element[collapsible]) {
+ if ($element['#collapsible']) {
drupal_add_js('misc/collapse.js');
- $element[attributes]['class'] .= ' collapsible';
- if ($element[collapsed]) {
- $element[attributes]['class'] .= ' collapsed';
+ $element['#attributes']['class'] .= ' collapsible';
+ if ($element['#collapsed']) {
+ $element['#attributes']['class'] .= ' collapsed';
}
}
- return '<fieldset' . drupal_attributes($element[attributes]) .'>' . ($element[title] ? '<legend>'. $element[title] .'</legend>' : '') . $element[children] . $element[value] . ($element[description] ? '<div class="description">'. $element[description] .'</div>' : '') . "</fieldset>\n";
+ return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . $element['#children'] . $element['#value'] . ($element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . "</fieldset>\n";
}
@@ -697,15 +386,15 @@ function theme_fieldset($element) {
*/
function theme_radio($element) {
$output = '<input type="radio" ';
- $output .= 'class="'. _form_get_class('form-radio', $element[required], _form_get_error($element[name])) .'" ';
- $output .= 'name="' . $element[name] .'" ';
- $output .= 'value="'. $element[return_value] .'" ';
- $output .= ($element[value] == $element[return_value]) ? ' checked="checked" ' : ' ';
- $output .= drupal_attributes($element[attributes]) .' />';
- if (!is_null($element[title])) {
- $output = '<label class="option">'. $output .' '. $element[title] .'</label>';
+ $output .= 'class="'. _form_get_class('form-radio', $element['#required'], _form_get_error($element['#name'])) .'" ';
+ $output .= 'name="' . $element['#name'] .'" ';
+ $output .= 'value="'. $element['#return_value'] .'" ';
+ $output .= ($element['#value'] == $element['#return_value']) ? ' checked="checked" ' : ' ';
+ $output .= drupal_attributes($element['#attributes']) .' />';
+ if (!is_null($element['#title'])) {
+ $output = '<label class="option">'. $output .' '. $element['#title'] .'</label>';
}
- return theme('form_element', NULL, $output, $element[description], $element[name], $element[required], _form_get_error($element[name]));
+ return theme('form_element', NULL, $output, $element['#description'], $element['#name'], $element['#required'], _form_get_error($element['#name']));
}
/**
@@ -718,11 +407,11 @@ function theme_radio($element) {
* A themed HTML string representing the radio button set.
*/
function theme_radios($element) {
- if ($element[title] || $element[description]) {
- return theme('form_element', $element[title], $element[children], $element[description], $element[id], $element[required], _form_get_error($element[name]));
+ if ($element['#title'] || $element['#description']) {
+ return theme('form_element', $element['#title'], $element['#children'], $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
}
else {
- return $element[children];
+ return $element['#children'];
}
}
@@ -736,8 +425,8 @@ function theme_radios($element) {
* A themed HTML string representing the radio button set.
*/
function theme_date($element) {
- $output = '<div class="container-inline">' . $element[children] . '</div>';
- return theme('form_element', $element[title], $output, $element[description], $element[id], $element[required], _form_get_error($element[name]));
+ $output = '<div class="container-inline">' . $element['#children'] . '</div>';
+ return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
}
/**
@@ -745,8 +434,8 @@ function theme_date($element) {
*/
function expand_date($element) {
// Default to current date
- if (!isset($element[value])) {
- $element[value] = array('day' => format_date(time(), 'custom', 'j'),
+ if (!isset($element['#value'])) {
+ $element['#value'] = array('day' => format_date(time(), 'custom', 'j'),
'month' => format_date(time(), 'custom', 'n'),
'year' => format_date(time(), 'custom', 'Y'));
}
@@ -773,7 +462,7 @@ function expand_date($element) {
$options = drupal_map_assoc(range(1900, 2050));
break;
}
- $element[$type] = array(type => 'radio', value => $element[value][$type], attributes => $element[attributes], parents => $element[parents], options => $options, tree => TRUE);
+ $element[$type] = array('#type' => 'radio', '#value' => $element['#value'][$type], '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], '#options' => $options, '#tree' => TRUE);
}
return $element;
@@ -785,10 +474,10 @@ function expand_date($element) {
* to a list of radios, using the options array as index.
*/
function expand_radios($element) {
- if (count($element[options]) > 0) {
- foreach ($element[options] as $key => $choice) {
+ if (count($element['#options']) > 0) {
+ foreach ($element['#options'] as $key => $choice) {
if (!$element[$key]) {
- $element[$key] = array(type => 'radio', title => $choice, return_value => $key, default_value => $element[default_value], attributes => $element[attributes], parents => $element[parents], spawned => TRUE);
+ $element[$key] = array('#type' => 'radio', '#title' => $choice, '#return_value' => $key, '#default_value' => $element['#default_value'], '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], '#spawned' => TRUE);
}
}
}
@@ -807,7 +496,7 @@ function expand_radios($element) {
* A themed HTML string representing the form item.
*/
function theme_item($element) {
- return theme('form_element', $element[title], $element[value] . $element[children], $element[description], $element[id], $element[required], $element[error]);
+ return theme('form_element', $element['#title'], $element['#value'] . $element['#children'], $element['#description'], $element['#id'], $element['#required'], $element['#error']);
}
@@ -823,18 +512,18 @@ function theme_item($element) {
function theme_checkbox($element) {
$checkbox = '<input ';
$checkbox .= 'type="checkbox" ';
- $checkbox .= 'class="'. _form_get_class('form-checkbox', $element[required], _form_get_error($element[name])) . '" ';
- $checkbox .= 'name="'. $element[name] .'" ';
- $checkbox .= 'id="'. $element[id].'" ' ;
- $checkbox .= 'value="'. $element[return_value] .'" ';
- $checkbox .= ($element[value] == $element[return_value]) ? ' checked="checked" ' : ' ';
- $checkbox .= drupal_attributes($element[attributes]) . ' />';
-
- if (!is_null($element[title])) {
- $checkbox = '<label class="option">'. $checkbox .' '. $element[title] .'</label>';
+ $checkbox .= 'class="'. _form_get_class('form-checkbox', $element['#required'], _form_get_error($element['#name'])) . '" ';
+ $checkbox .= 'name="'. $element['#name'] .'" ';
+ $checkbox .= 'id="'. $element['#id'].'" ' ;
+ $checkbox .= 'value="'. $element['#return_value'] .'" ';
+ $checkbox .= ($element['#value'] == $element['#return_value']) ? ' checked="checked" ' : ' ';
+ $checkbox .= drupal_attributes($element['#attributes']) . ' />';
+
+ if (!is_null($element['#title'])) {
+ $checkbox = '<label class="option">'. $checkbox .' '. $element['#title'] .'</label>';
}
- return theme('form_element', NULL, $checkbox, $element[description], $element[name], $element[required], _form_get_error($element[name]));
+ return theme('form_element', NULL, $checkbox, $element['#description'], $element['#name'], $element['#required'], _form_get_error($element['#name']));
}
/**
@@ -846,23 +535,23 @@ function theme_checkbox($element) {
* A themed HTML string representing the checkbox set.
*/
function theme_checkboxes($element) {
- if ($element[title] || $element[description]) {
- return theme('form_element', $element[title], $element[children], $element[description], 'edit-'. $element[name], $element[required], _form_get_error($element[name]));
+ if ($element['#title'] || $element['#description']) {
+ return theme('form_element', $element['#title'], $element['#children'], $element['#description'], 'edit-'. $element['#name'], $element['#required'], _form_get_error($element['#name']));
}
else {
- return $element[children];
+ return $element['#children'];
}
}
function expand_checkboxes($element) {
- $value = is_array($element[value]) ? $element[value] : array();
- if (count($element[options]) > 0) {
- if (!isset($element[default_value]) || $element[default_value] == 0) {
- $element[default_value] = array();
+ $value = is_array($element['#value']) ? $element['#value'] : array();
+ if (count($element['#options']) > 0) {
+ if (!isset($element['#default_value']) || $element['#default_value'] == 0) {
+ $element['#default_value'] = array();
}
- foreach ($element[options] as $key => $choice) {
+ foreach ($element['#options'] as $key => $choice) {
if (!isset($element[$key])) {
- $element[$key] = array(type => 'checkbox', processed => TRUE, title => $choice, tree => TRUE, default_value => in_array($key, $value), attributes => $element[attributes]);
+ $element[$key] = array('#type' => 'checkbox', '#processed' => TRUE, '#title' => $choice, '#tree' => TRUE, '#default_value' => in_array($key, $value), '#attributes' => $element['#attributes']);
}
}
}
@@ -875,7 +564,7 @@ function theme_submit($element) {
}
function theme_button($element) {
- return '<input type="submit" class="form-'. $element[button_type] .'" name="'. $element[name] .'" value="'. check_plain($element[value]) .'" '. drupal_attributes($element[attributes]) ." />\n";
+ return '<input type="submit" class="form-'. $element['#button_type'] .'" name="'. $element['#name'] .'" value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
}
/**
@@ -888,7 +577,7 @@ function theme_button($element) {
* A themed HTML string representing the hidden form field.
*/
function theme_hidden($element) {
- return '<input type="hidden" name="'. $element[name] . '" id="' . $element[id] . '" value="'. check_plain($element[value]) ."\" " . drupal_attributes($element[attributes]) ." />\n";
+ return '<input type="hidden" name="'. $element['#name'] . '" id="' . $element['#id'] . '" value="'. check_plain($element['#value']) ."\" " . drupal_attributes($element['#attributes']) ." />\n";
}
/**
@@ -901,15 +590,15 @@ function theme_hidden($element) {
* A themed HTML string representing the textfield.
*/
function theme_textfield($element) {
- $size = $element[size] ? ' size="' . $element[size] . '"' : '';
- if ($element[autocomplete_path]) {
+ $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
+ if ($element['#autocomplete_path']) {
drupal_add_js('misc/autocomplete.js');
$class = ' form-autocomplete';
- $extra = '<input class="autocomplete" type="hidden" id="'. $element[id] .'-autocomplete" value="'. check_url(url($element[autocomplete_path], NULL, NULL, TRUE)) .'" disabled="disabled" />';
+ $extra = '<input class="autocomplete" type="hidden" id="'. $element['#id'] .'-autocomplete" value="'. check_url(url($element['#autocomplete_path'], NULL, NULL, TRUE)) .'" disabled="disabled" />';
}
- $output = '<input type="text" maxlength="'. $element[maxlength] .'" class="'. _form_get_class("form-text$class", $element[required], _form_get_error($element[name])) .'" name="'. $element[name] .'" id="'. $element[id] .'" '. $size .' value="'. check_plain($element[value]) .'"'. drupal_attributes($element[attributes]) .' />';
- return theme('form_element', $element[title], $output, $element[description], $element[id], $element[required], _form_get_error($element[name])). $extra;
+ $output = '<input type="text" maxlength="'. $element['#maxlength'] .'" class="'. _form_get_class("form-text$class", $element['#required'], _form_get_error($element['#name'])) .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
+ return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name'])). $extra;
}
/**
@@ -923,8 +612,8 @@ function theme_textfield($element) {
*/
function theme_form($element) {
// Anonymous div to satisfy XHTML compliancy.
- $action = $element[action] ? 'action="' . check_url($element[action]) . '" ' : '';
- return '<form '. $action . ' method="'. $element[method] .'" '. drupal_attributes($element[attributes]) .">\n<div>". $element[children] ."\n</div></form>\n";
+ $action = $element['#action'] ? 'action="' . check_url($element['#action']) . '" ' : '';
+ return '<form '. $action . ' method="'. $element['#method'] .'" '. drupal_attributes($element['#attributes']) .">\n<div>". $element['#children'] ."\n</div></form>\n";
}
@@ -938,9 +627,9 @@ function theme_form($element) {
* A themed HTML string representing the textarea.
*/
function theme_textarea($element) {
- $cols = $element[cols] ? ' cols="'. $element[cols] .'"' : '';
+ $cols = $element['#cols'] ? ' cols="'. $element['#cols'] .'"' : '';
- return theme('form_element', $element[title], '<textarea'. $cols .' rows="'. $element[rows] .'" name="'. $element[name] .'" id="' . $element[id] .'" class="'. _form_get_class('textarea', $element[required], _form_get_error($element[name])) .'"'. drupal_attributes($element[attributes]) .'>'. check_plain($element[value]) .'</textarea>', $element[description], $element[id], $element[required], _form_get_error($element[name]));
+ return theme('form_element', $element['#title'], '<textarea'. $cols .' rows="'. $element['#rows'] .'" name="'. $element['#name'] .'" id="' . $element['#id'] .'" class="'. _form_get_class('textarea', $element['#required'], _form_get_error($element['#name'])) .'"'. drupal_attributes($element['#attributes']) .'>'. check_plain($element['#value']) .'</textarea>', $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
}
/**
@@ -956,7 +645,7 @@ function theme_textarea($element) {
*/
function theme_markup($element) {
- return $element[value] . $element[children];
+ return $element['#value'] . $element['#children'];
}
@@ -971,11 +660,11 @@ function theme_markup($element) {
* A themed HTML string representing the form.
*/
function theme_password($element) {
- $size = $element[size] ? ' size="'. $element[size] .'" ' : '';
+ $size = $element['#size'] ? ' size="'. $element['#size'] .'" ' : '';
- $output = '<input type="password" maxlength="'. $element[maxlength] .'" class="'. _form_get_class("form-text $class", $element[required], _form_get_error($element[name])) .'" name="'. $element[name] .'" id="'. $element[id] .'" '. $size . drupal_attributes($element[attributes]) .' />';
+ $output = '<input type="password" maxlength="'. $element['#maxlength'] .'" class="'. _form_get_class("form-text $class", $element['#required'], _form_get_error($element['#name'])) .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size . drupal_attributes($element['#attributes']) .' />';
- return theme('form_element', $element[title], $output, $element[description], $element[id], $element[required], _form_get_error($element[name]));
+ return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
}
/**
@@ -988,11 +677,11 @@ function theme_password($element) {
* A themed HTML string representing the form.
*/
function theme_weight($element) {
- for ($n = (-1 * $element[delta]); $n <= $element[delta]; $n++) {
+ for ($n = (-1 * $element['#delta']); $n <= $element['#delta']; $n++) {
$weights[$n] = $n;
}
- $element[options] = $weights;
- $element[type] = 'select';
+ $element['#options'] = $weights;
+ $element['#type'] = 'select';
return form_render($element);
}
@@ -1034,7 +723,7 @@ function form_get_errors() {
* provided by file.inc.
*/
function theme_file($element) {
- return theme('form_element', $element[title], '<input type="file" class="'. _form_get_class('form-file', $element[required], _form_get_error($element[name])) .'" name="'. $element[name] .'" id="'. form_clean_id($element[id]) .'" size="'. $element[size] ."\" />\n", $element[description], $element[id], $element[required], _form_get_error($element[name]));
+ return theme('form_element', $element['#title'], '<input type="file" class="'. _form_get_class('form-file', $element['#required'], _form_get_error($element['#name'])) .'" name="'. $element['#name'] .'" id="'. form_clean_id($element['#id']) .'" size="'. $element['#size'] ."\" />\n", $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
}
/**
diff --git a/includes/locale.inc b/includes/locale.inc
index 817839b1a..403433869 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -39,8 +39,8 @@ function _locale_admin_manage_screen() {
$languages = locale_supported_languages(TRUE, TRUE);
$options = array();
- $form[action] = url('admin/locale');
- $form['name'] = array(tree => TRUE);
+ $form['#action'] = url('admin/locale');
+ $form['name'] = array('#tree' => TRUE);
foreach ($languages['name'] as $key => $lang) {
$options[$key] = '';
$status = db_fetch_object(db_query("SELECT isdefault, enabled FROM {locales_meta} WHERE locale = '%s'", $key));
@@ -51,7 +51,7 @@ function _locale_admin_manage_screen() {
$isdefault = $key;
}
if ($key == 'en') {
- $form['name']['en'] = array(type => 'markup', value => check_plain($lang));
+ $form['name']['en'] = array('#type' => 'markup', '#value' => check_plain($lang));
}
else {
$original = db_fetch_object(db_query("SELECT COUNT(*) AS strings FROM {locales_source}"));
@@ -59,13 +59,13 @@ function _locale_admin_manage_screen() {
$ratio = ($original->strings > 0 && $translation->translation > 0) ? round(($translation->translation/$original->strings)*100., 2) : 0;
- $form['name'][$key] = array(type => 'textfield', default_value => $lang, size => 15, maxlength => 64);
- $form['translation'][$key] = array(type => 'markup', default_value => "$translation->translation/$original->strings ($ratio%)");
+ $form['name'][$key] = array('#type' => 'textfield', '#default_value' => $lang, '#size' => 15, '#maxlength' => 64);
+ $form['translation'][$key] = array('#type' => 'markup', '#default_value' => "$translation->translation/$original->strings ($ratio%)");
}
}
- $form['enabled'] = array(type => 'checkboxes', options => $options, default_value => $enabled, return_value => 1);
- $form['sitedefault'] = array(type => 'radios', options => $options, default_value => $isdefault, return_value => 1);
- $form['submit'] = array(type => 'submit', value => t('Save configuration'));
+ $form['enabled'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $enabled, '#return_value' => 1);
+ $form['sitedefault'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $isdefault, '#return_value' => 1);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('_locale_admin_manage_screen', $form);
}
@@ -91,17 +91,17 @@ function _locale_admin_manage_add_screen() {
$isocodes = _locale_prepare_iso_list();
$form = array();
- $form['header'] = array(prefix => '<h2>', value => t('Language list'), suffix => '</h2>');
- $form['langcode'] = array(type => 'select', title => t('Language name'), default_value => key($isocodes), options => $isocodes, description => t('Select your language here, or add it below, if you are unable to find it.'));
- $form['submit'] = array(type => 'submit', value => t('Add language'));
+ $form['header'] = array('#prefix' => '<h2>', '#value' => t('Language list'), '#suffix' => '</h2>');
+ $form['langcode'] = array('#type' => 'select', '#title' => t('Language name'), '#default_value' => key($isocodes), '#options' => $isocodes, '#description' => t('Select your language here, or add it below, if you are unable to find it.'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Add language'));
$output = drupal_get_form('locale_add_language', $form);
$edit = &$_POST['edit'];
$form = array();
- $form['header'] = array(prefix => '<h2>', value => t('Custom language') , suffix => '</h2>');
- $form['langcode'] = array(type => 'textfield', title => t('Language code'), default_value => $edit['langcode'], size => 12, maxlength => 60, description => t("Commonly this is an <a href=\"%iso-codes\">ISO 639 language code</a> with an optional country code for regional variants. Examples include 'en', 'en-US' and 'zh-cn'.", array('%iso-codes' => 'http://www.w3.org/WAI/ER/IG/ert/iso639.htm')));
- $form['langname'] = array(type => 'textfield', title => t('Language name in English'), default_value => $edit['langname'], size => 60, maxlength => 64, description => t('Name of the language. Will be available for translation in all languages.'));
- $form['submit'] = array(type => 'submit', value => t('Add custom language'));
+ $form['header'] = array('#prefix' => '<h2>', '#value' => t('Custom language') , '#suffix' => '</h2>');
+ $form['langcode'] = array('#type' => 'textfield', '#title' => t('Language code'), '#default_value' => $edit['langcode'], '#size' => 12, '#maxlength' => 60, '#description' => t("Commonly this is an <a href=\"%iso-codes\">ISO 639 language code</a> with an optional country code for regional variants. Examples include 'en', 'en-US' and 'zh-cn'.", array('%iso-codes' => 'http://www.w3.org/WAI/ER/IG/ert/iso639.htm')));
+ $form['langname'] = array('#type' => 'textfield', '#title' => t('Language name in English'), '#default_value' => $edit['langname'], '#size' => 60, '#maxlength' => 64, '#description' => t('Name of the language. Will be available for translation in all languages.'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Add custom language'));
$output .= drupal_get_form('_locale_custom_language', $form);
@@ -127,12 +127,12 @@ function _locale_admin_import_screen() {
}
$form = array();
- $form['file'] = array(type => 'file', title => t('Language file'), size => 50, description => t('A gettext Portable Object (.po) file.'));
- $form['langcode'] = array(type => 'select', title => t('Import into'), options => $languages, description => t('Choose the language you want to add strings into. If you choose a language which is not yet set up, then it will be added.'));
- $form['mode'] = array(type => 'radios', title => t('Mode'), default_value => 'overwrite', options => array('overwrite' => t('Strings in the uploaded file replace existing ones, new ones are added'), 'keep' => t('Existing strings are kept, only new strings are added')));
- $form['submit'] = array(type => 'submit', value => t('Import'));
- $form[attributes]['enctype'] = 'multipart/form-data';
- $form[action] = 'admin/locale/language/import';
+ $form['file'] = array('#type' => 'file', '#title' => t('Language file'), '#size' => 50, '#description' => t('A gettext Portable Object (.po) file.'));
+ $form['langcode'] = array('#type' => 'select', '#title' => t('Import into'), '#options' => $languages, '#description' => t('Choose the language you want to add strings into. If you choose a language which is not yet set up, then it will be added.'));
+ $form['mode'] = array('#type' => 'radios', '#title' => t('Mode'), '#default_value' => 'overwrite', '#options' => array('overwrite' => t('Strings in the uploaded file replace existing ones, new ones are added'), 'keep' => t('Existing strings are kept, only new strings are added')));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Import'));
+ $form['#attributes']['enctype'] = 'multipart/form-data';
+ $form['#action'] = 'admin/locale/language/import';
return drupal_get_form('_locale_admin_import', $form);
}
@@ -733,8 +733,8 @@ function _locale_admin_export_screen() {
if (count($languages)) {
$output .= '<h2>'. t('Export translation') .'</h2>';
$form = array();
- $form['langcode'] = array(type => 'select', title => t('Language name'), options => $languages, description => t('Select the language you would like to export in gettext Portable Object (.po) format.'));
- $form['submit'] = array(type => 'submit', value => t('Export'));
+ $form['langcode'] = array('#type' => 'select', '#title' => t('Language name'), '#options' => $languages, '#description' => t('Select the language you would like to export in gettext Portable Object (.po) format.'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Export'));
$output .= drupal_get_form('_locale_export_po', $form);
}
@@ -742,7 +742,7 @@ function _locale_admin_export_screen() {
$output .= '<h2>'. t('Export template') .'</h2>';
$output .= t('<p>Generate a gettext Portable Object Template (.pot) file with all the interface strings from the Drupal locale database.</p>');
$form = array();
- $form['submit'] = array(type => 'submit', value => t('Export'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Export'));
$output .= drupal_get_form('_locale_export_pot', $form);
return $output;
@@ -980,18 +980,18 @@ function _locale_string_edit($lid) {
while ($translation = db_fetch_object($result)) {
$orig = $translation->source;
$form[$translation->locale] = (strlen($orig) > 40) ?
- array(type => 'textarea', title => $languages['name'][$translation->locale], default_value => $translation->translation, cols => 60, rows => 15)
- : array(type => 'textfield', title => $languages['name'][$translation->locale], default_value => $translation->translation, size => 60, maxlength => 128);
+ array('#type' => 'textarea', '#title' => $languages['name'][$translation->locale], '#default_value' => $translation->translation, '#cols' => 60, '#rows' => 15)
+ : array('#type' => 'textfield', '#title' => $languages['name'][$translation->locale], '#default_value' => $translation->translation, '#size' => 60, '#maxlength' => 128);
unset($languages['name'][$translation->locale]);
}
- $form = array(type => 'item', title => t('Original text'), value => wordwrap(check_plain($orig, 0)));
+ $form = array('#type' => 'item', '#title' => t('Original text'), '#value' => wordwrap(check_plain($orig, 0)));
foreach ($languages['name'] as $key => $lang) {
$form[$key] = (strlen($orig) > 40) ?
-array(type => 'textarea', title => $lang, cols => 60, rows => 15) :
-array(type => 'textfield', title => $lang, size => 60, maxlength => 128);
+array('#type' => 'textarea', '#title' => $lang, '#cols' => 60, '#rows' => 15) :
+array('#type' => 'textfield', '#title' => $lang, '#size' => 60, '#maxlength' => 128);
}
- $form['submit'] = array(type => 'submit', value => t('Save translations'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save translations'));
return $form;
}
@@ -1122,12 +1122,12 @@ function _locale_string_seek_form() {
// Present edit form preserving previous user settings
$query = _locale_string_seek_query();
$form = array();
- $form['search'] = array(type => 'fieldset', title => t('Search'));
- $form['search']['string'] = array(type => 'textfield', title => t('Strings to search for'), default_value => $query->string, size => 30, maxlength => 30, description => t('Leave blank to show all strings. The search is case sensitive.'));
- $form['search']['language'] = array(type => 'radios', title => t('Language'), default_value => ($query->language ? $query->language : 'all'), options => array_merge(array('all' => t('All languages'), 'en' => t('English (provided by Drupal)')), $languages['name']));
- $form['search']['searchin'] = array(type => 'radios', title => t('Search in'), default_value => ($query->searchin ? $query->searchin : 'all'), options => array('all' => t('All strings in that language'), 'translated' => t('Only translated strings'), 'untranslated' => t('Only untranslated strings')));
- $form['search']['submit'] = array(type => 'submit', value => t('Search'));
- $form[action] = 'admin/locale/string/search';
+ $form['search'] = array('#type' => 'fieldset', '#title' => t('Search'));
+ $form['search']['string'] = array('#type' => 'textfield', '#title' => t('Strings to search for'), '#default_value' => $query->string, '#size' => 30, '#maxlength' => 30, '#description' => t('Leave blank to show all strings. The search is case sensitive.'));
+ $form['search']['language'] = array('#type' => 'radios', '#title' => t('Language'), '#default_value' => ($query->language ? $query->language : 'all'), '#options' => array_merge(array('all' => t('All languages'), 'en' => t('English (provided by Drupal)')), $languages['name']));
+ $form['search']['searchin'] = array('#type' => 'radios', '#title' => t('Search in'), '#default_value' => ($query->searchin ? $query->searchin : 'all'), '#options' => array('all' => t('All strings in that language'), 'translated' => t('Only translated strings'), 'untranslated' => t('Only untranslated strings')));
+ $form['search']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
+ $form['#action'] = 'admin/locale/string/search';
return drupal_get_form('_locale_string_seek', $form);
}
diff --git a/includes/unicode.inc b/includes/unicode.inc
index ce6ba32ac..3508aad64 100644
--- a/includes/unicode.inc
+++ b/includes/unicode.inc
@@ -81,7 +81,7 @@ function unicode_settings() {
$options = array(UNICODE_SINGLEBYTE => t('Standard PHP: operations on Unicode strings are emulated on a best-effort basis. Install the <a href="%url">PHP mbstring extension</a> for improved Unicode support.', array('%url' => 'http://www.php.net/mbstring')),
UNICODE_MULTIBYTE => t('Multi-byte: operations on Unicode strings are supported through the <a href="%url">PHP mbstring extension</a>.', array('%url' => 'http://www.php.net/mbstring')),
UNICODE_ERROR => t('Invalid: the current configuration is incompatible with Drupal.'));
- $form['settings'] = array(type => 'item', title =>t('String handling method'), value => $options[$status]);
+ $form['settings'] = array('#type' => 'item', '#title' =>t('String handling method'), '#value' => $options[$status]);
return $form;
}
diff --git a/modules/aggregator.module b/modules/aggregator.module
index 2efcf03b0..58a5ef224 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -73,27 +73,27 @@ function aggregator_settings() {
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
$form['aggregator_allowed_html_tags'] = array(
- type => 'textfield', title => t('Allowed HTML tags'), size => 80, maxlength => 255,
- default_value => variable_get('aggregator_allowed_html_tags', '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'),
- description => t('The list of tags which are allowed in feeds, i.e., which will not be removed by Drupal.')
+ '#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#size' => 80, '#maxlength' => 255,
+ '#default_value' => variable_get('aggregator_allowed_html_tags', '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'),
+ '#description' => t('The list of tags which are allowed in feeds, i.e., which will not be removed by Drupal.')
);
$form['aggregator_summary_items'] = array(
- type => 'select', title => t('Items shown in sources and categories pages') ,
- default_value => variable_get('aggregator_summary_items', 3), options => $items,
- description => t('The number of items which will be shown with each feed or category in the feed and category summary pages.')
+ '#type' => 'select', '#title' => t('Items shown in sources and categories pages') ,
+ '#default_value' => variable_get('aggregator_summary_items', 3), '#options' => $items,
+ '#description' => t('The number of items which will be shown with each feed or category in the feed and category summary pages.')
);
$form['aggregator_clear'] = array(
- type => 'select', title => t('Discard news items older than'),
- default_value => variable_get('aggregator_clear', 9676800), options => $period,
- description => t('Older news items will be automatically discarded. Requires crontab.')
+ '#type' => 'select', '#title' => t('Discard news items older than'),
+ '#default_value' => variable_get('aggregator_clear', 9676800), '#options' => $period,
+ '#description' => t('Older news items will be automatically discarded. Requires crontab.')
);
$form['aggregator_category_selector'] = array(
- type => 'radios', title => t('Category selection type'), default_value => variable_get('aggregator_category_selector', 'check'),
- options => array('check' => t('checkboxes'), 'select' => t('multiple selector')),
- description => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
+ '#type' => 'radios', '#title' => t('Category selection type'), '#default_value' => variable_get('aggregator_category_selector', 'check'),
+ '#options' => array('check' => t('checkboxes'), 'select' => t('multiple selector')),
+ '#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
);
return $form;
}
@@ -237,7 +237,7 @@ function aggregator_block($op, $delta = 0, $edit = array()) {
else {
$value = db_result(db_query('SELECT block FROM {aggregator_feed} WHERE fid = %d', $id));
}
- $form['block'] = array(type => 'select', title => t('Number of news items in block'), default_value => $value, options => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
+ $form['block'] = array('#type' => 'select', '#title' => t('Number of news items in block'), '#default_value' => $value, '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
return $form;
}
else if ($op == 'save') {
@@ -471,8 +471,8 @@ function aggregator_refresh($feed) {
cache_clear_all();
- watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
- drupal_set_message(t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
+ watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed['#title']))));
+ drupal_set_message(t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed['#title']))));
}
break;
default:
@@ -675,13 +675,13 @@ function aggregator_save_item($edit) {
}
function aggregator_form_category($edit = array()) {
- $form['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 64);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5);
- $form['submit'] = array(type => 'submit', value =>t('Submit'));
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64);
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5);
+ $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
if ($edit['cid']) {
- $form['delete'] = array(type => 'submit', value =>t('Delete'));
- $form['cid'] = array(type => 'hidden', value => $edit['cid']);
+ $form['delete'] = array('#type' => 'submit', '#value' =>t('Delete'));
+ $form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']);
}
return drupal_get_form('aggregator_form_category', $form);
@@ -709,9 +709,9 @@ function aggregator_form_feed($edit = array()) {
}
- $form['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 64, description => t('The name of the feed; typically the name of the web site you syndicate content from.'));
- $form['url'] = array(type => 'textfield', title => t('URL'), default_value => $edit['url'], size => 60, maxlength => 255, description => t('The fully-qualified URL of the feed.'));
- $form['refresh'] = array(type => 'select', title => t('Update interval'), default_value => $edit['refresh'], options => $period, description => t('The refresh interval indicating how often you want to update this feed. Requires crontab.'));
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64, '#description' => t('The name of the feed; typically the name of the web site you syndicate content from.'));
+ $form['url'] = array('#type' => 'textfield', '#title' => t('URL'), '#default_value' => $edit['url'], '#size' => 60, '#maxlength' => 255, '#description' => t('The fully-qualified URL of the feed.'));
+ $form['refresh'] = array('#type' => 'select', '#title' => t('Update interval'), '#default_value' => $edit['refresh'], '#options' => $period, '#description' => t('The refresh interval indicating how often you want to update this feed. Requires crontab.'));
// Handling of categories:
$options = array();
@@ -722,13 +722,13 @@ function aggregator_form_feed($edit = array()) {
if ($category->fid) $values[] = check_plain($category->cid);
}
if ($options) {
- $form['category'] = array(type => 'checkboxes', title => t('Categorize news items'), default_value => $values, options => $options, description => t('New items in this feed will be automatically filed in the checked categories as they are received.'));
+ $form['category'] = array('#type' => 'checkboxes', '#title' => t('Categorize news items'), '#default_value' => $values, '#options' => $options, '#description' => t('New items in this feed will be automatically filed in the checked categories as they are received.'));
}
- $form['submit'] = array(type => 'submit', value =>t('Submit'));
+ $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
if ($edit['fid']) {
- $form['delete'] = array(type => 'submit', value =>t('Delete'));
- $form['fid'] = array(type => 'hidden', value => $edit['fid']);
+ $form['delete'] = array('#type' => 'submit', '#value' =>t('Delete'));
+ $form['fid'] = array('#type' => 'hidden', '#value' => $edit['fid']);
}
return drupal_get_form('aggregator_form_feed', $form);
@@ -961,14 +961,14 @@ function _aggregator_page_list($sql, $op, $header = '') {
$output = '<div id="aggregator">';
- $form['header'] = array(value => $header);
- $output .= $form['header'][value];
+ $form['header'] = array('#value' => $header);
+ $output .= $form['header']['#value'];
$result = pager_query($sql, 20);
$categories = array();
while ($item = db_fetch_object($result)) {
- $form['items'][$item->iid] = array(value => theme('aggregator_page_item', $item));
- $output .= $form['items'][$item->iid][value];
+ $form['items'][$item->iid] = array('#value' => theme('aggregator_page_item', $item));
+ $output .= $form['items'][$item->iid]['#value'];
$form['categories'][$item->iid] = array();
if ($categorize) {
@@ -985,26 +985,26 @@ function _aggregator_page_list($sql, $op, $header = '') {
}
$done = true;
$form['categories'][$item->iid] = array(
- type => variable_get('aggregator_category_selector', 'checkboxes'),
- default_value => $selected, options => $categories,
- size => 10, multiple => true
+ '#type' => variable_get('aggregator_category_selector', 'checkboxes'),
+ '#default_value' => $selected, '#options' => $categories,
+ '#size' => 10, '#multiple' => true
);
}
}
$output .= '</div>';
- $form['submit'] = array(type => 'submit', value => t('Save categories'));
- $form['pager'] = array(value => theme('pager', NULL, 20, 0));
- $output .= $form['pager'][value];
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save categories'));
+ $form['pager'] = array('#value' => theme('pager', NULL, 20, 0));
+ $output .= $form['pager']['#value'];
// arg(1) is undefined if we are at the top aggregator URL
// is there a better way to do this?
if (!arg(1)) {
- $form['xml_icon'] = array(value => theme('xml_icon', url('aggregator/rss')));
+ $form['xml_icon'] = array('#value' => theme('xml_icon', url('aggregator/rss')));
}
elseif (arg(1) == 'categories' && arg(2) && !arg(3)) {
- $form['xml_icon'] = array(value => theme('xml_icon', url('aggregator/rss/' . arg(2))));
+ $form['xml_icon'] = array('#value' => theme('xml_icon', url('aggregator/rss/' . arg(2))));
}
- $output .= $form['xml_icon'][value];
+ $output .= $form['xml_icon']['#value'];
return ($categorize) ? drupal_get_form('aggregator_page_list', $form) : $output;
}
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 2efcf03b0..58a5ef224 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -73,27 +73,27 @@ function aggregator_settings() {
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
$form['aggregator_allowed_html_tags'] = array(
- type => 'textfield', title => t('Allowed HTML tags'), size => 80, maxlength => 255,
- default_value => variable_get('aggregator_allowed_html_tags', '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'),
- description => t('The list of tags which are allowed in feeds, i.e., which will not be removed by Drupal.')
+ '#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#size' => 80, '#maxlength' => 255,
+ '#default_value' => variable_get('aggregator_allowed_html_tags', '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'),
+ '#description' => t('The list of tags which are allowed in feeds, i.e., which will not be removed by Drupal.')
);
$form['aggregator_summary_items'] = array(
- type => 'select', title => t('Items shown in sources and categories pages') ,
- default_value => variable_get('aggregator_summary_items', 3), options => $items,
- description => t('The number of items which will be shown with each feed or category in the feed and category summary pages.')
+ '#type' => 'select', '#title' => t('Items shown in sources and categories pages') ,
+ '#default_value' => variable_get('aggregator_summary_items', 3), '#options' => $items,
+ '#description' => t('The number of items which will be shown with each feed or category in the feed and category summary pages.')
);
$form['aggregator_clear'] = array(
- type => 'select', title => t('Discard news items older than'),
- default_value => variable_get('aggregator_clear', 9676800), options => $period,
- description => t('Older news items will be automatically discarded. Requires crontab.')
+ '#type' => 'select', '#title' => t('Discard news items older than'),
+ '#default_value' => variable_get('aggregator_clear', 9676800), '#options' => $period,
+ '#description' => t('Older news items will be automatically discarded. Requires crontab.')
);
$form['aggregator_category_selector'] = array(
- type => 'radios', title => t('Category selection type'), default_value => variable_get('aggregator_category_selector', 'check'),
- options => array('check' => t('checkboxes'), 'select' => t('multiple selector')),
- description => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
+ '#type' => 'radios', '#title' => t('Category selection type'), '#default_value' => variable_get('aggregator_category_selector', 'check'),
+ '#options' => array('check' => t('checkboxes'), 'select' => t('multiple selector')),
+ '#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
);
return $form;
}
@@ -237,7 +237,7 @@ function aggregator_block($op, $delta = 0, $edit = array()) {
else {
$value = db_result(db_query('SELECT block FROM {aggregator_feed} WHERE fid = %d', $id));
}
- $form['block'] = array(type => 'select', title => t('Number of news items in block'), default_value => $value, options => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
+ $form['block'] = array('#type' => 'select', '#title' => t('Number of news items in block'), '#default_value' => $value, '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
return $form;
}
else if ($op == 'save') {
@@ -471,8 +471,8 @@ function aggregator_refresh($feed) {
cache_clear_all();
- watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
- drupal_set_message(t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
+ watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed['#title']))));
+ drupal_set_message(t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed['#title']))));
}
break;
default:
@@ -675,13 +675,13 @@ function aggregator_save_item($edit) {
}
function aggregator_form_category($edit = array()) {
- $form['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 64);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5);
- $form['submit'] = array(type => 'submit', value =>t('Submit'));
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64);
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5);
+ $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
if ($edit['cid']) {
- $form['delete'] = array(type => 'submit', value =>t('Delete'));
- $form['cid'] = array(type => 'hidden', value => $edit['cid']);
+ $form['delete'] = array('#type' => 'submit', '#value' =>t('Delete'));
+ $form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']);
}
return drupal_get_form('aggregator_form_category', $form);
@@ -709,9 +709,9 @@ function aggregator_form_feed($edit = array()) {
}
- $form['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 64, description => t('The name of the feed; typically the name of the web site you syndicate content from.'));
- $form['url'] = array(type => 'textfield', title => t('URL'), default_value => $edit['url'], size => 60, maxlength => 255, description => t('The fully-qualified URL of the feed.'));
- $form['refresh'] = array(type => 'select', title => t('Update interval'), default_value => $edit['refresh'], options => $period, description => t('The refresh interval indicating how often you want to update this feed. Requires crontab.'));
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64, '#description' => t('The name of the feed; typically the name of the web site you syndicate content from.'));
+ $form['url'] = array('#type' => 'textfield', '#title' => t('URL'), '#default_value' => $edit['url'], '#size' => 60, '#maxlength' => 255, '#description' => t('The fully-qualified URL of the feed.'));
+ $form['refresh'] = array('#type' => 'select', '#title' => t('Update interval'), '#default_value' => $edit['refresh'], '#options' => $period, '#description' => t('The refresh interval indicating how often you want to update this feed. Requires crontab.'));
// Handling of categories:
$options = array();
@@ -722,13 +722,13 @@ function aggregator_form_feed($edit = array()) {
if ($category->fid) $values[] = check_plain($category->cid);
}
if ($options) {
- $form['category'] = array(type => 'checkboxes', title => t('Categorize news items'), default_value => $values, options => $options, description => t('New items in this feed will be automatically filed in the checked categories as they are received.'));
+ $form['category'] = array('#type' => 'checkboxes', '#title' => t('Categorize news items'), '#default_value' => $values, '#options' => $options, '#description' => t('New items in this feed will be automatically filed in the checked categories as they are received.'));
}
- $form['submit'] = array(type => 'submit', value =>t('Submit'));
+ $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
if ($edit['fid']) {
- $form['delete'] = array(type => 'submit', value =>t('Delete'));
- $form['fid'] = array(type => 'hidden', value => $edit['fid']);
+ $form['delete'] = array('#type' => 'submit', '#value' =>t('Delete'));
+ $form['fid'] = array('#type' => 'hidden', '#value' => $edit['fid']);
}
return drupal_get_form('aggregator_form_feed', $form);
@@ -961,14 +961,14 @@ function _aggregator_page_list($sql, $op, $header = '') {
$output = '<div id="aggregator">';
- $form['header'] = array(value => $header);
- $output .= $form['header'][value];
+ $form['header'] = array('#value' => $header);
+ $output .= $form['header']['#value'];
$result = pager_query($sql, 20);
$categories = array();
while ($item = db_fetch_object($result)) {
- $form['items'][$item->iid] = array(value => theme('aggregator_page_item', $item));
- $output .= $form['items'][$item->iid][value];
+ $form['items'][$item->iid] = array('#value' => theme('aggregator_page_item', $item));
+ $output .= $form['items'][$item->iid]['#value'];
$form['categories'][$item->iid] = array();
if ($categorize) {
@@ -985,26 +985,26 @@ function _aggregator_page_list($sql, $op, $header = '') {
}
$done = true;
$form['categories'][$item->iid] = array(
- type => variable_get('aggregator_category_selector', 'checkboxes'),
- default_value => $selected, options => $categories,
- size => 10, multiple => true
+ '#type' => variable_get('aggregator_category_selector', 'checkboxes'),
+ '#default_value' => $selected, '#options' => $categories,
+ '#size' => 10, '#multiple' => true
);
}
}
$output .= '</div>';
- $form['submit'] = array(type => 'submit', value => t('Save categories'));
- $form['pager'] = array(value => theme('pager', NULL, 20, 0));
- $output .= $form['pager'][value];
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save categories'));
+ $form['pager'] = array('#value' => theme('pager', NULL, 20, 0));
+ $output .= $form['pager']['#value'];
// arg(1) is undefined if we are at the top aggregator URL
// is there a better way to do this?
if (!arg(1)) {
- $form['xml_icon'] = array(value => theme('xml_icon', url('aggregator/rss')));
+ $form['xml_icon'] = array('#value' => theme('xml_icon', url('aggregator/rss')));
}
elseif (arg(1) == 'categories' && arg(2) && !arg(3)) {
- $form['xml_icon'] = array(value => theme('xml_icon', url('aggregator/rss/' . arg(2))));
+ $form['xml_icon'] = array('#value' => theme('xml_icon', url('aggregator/rss/' . arg(2))));
}
- $output .= $form['xml_icon'][value];
+ $output .= $form['xml_icon']['#value'];
return ($categorize) ? drupal_get_form('aggregator_page_list', $form) : $output;
}
diff --git a/modules/block.module b/modules/block.module
index 5f95aa80e..333920156 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -207,24 +207,24 @@ function block_admin_display() {
$blocks = _block_rehash();
$block_regions = system_region_list($theme_key);
- $form[action] = arg(3) ? url('admin/block/list/' . $theme_key) : url('admin/block');
- $form[tree] = TRUE;
+ $form['#action'] = arg(3) ? url('admin/block/list/' . $theme_key) : url('admin/block');
+ $form['#tree'] = TRUE;
foreach ($blocks as $block) {
- $form[$block['module']][$block['delta']]['info'] = array(type => 'markup', value => $block['info']);
- $form[$block['module']][$block['delta']]['status'] = array(type => 'checkbox', default_value => $block['status']);
- $form[$block['module']][$block['delta']]['theme'] = array(type => 'hidden', value => $theme_key);
- $form[$block['module']][$block['delta']]['weight'] = array(type => 'weight', default_value => $block['weight']);
- $form[$block['module']][$block['delta']]['region'] = array(type => 'select', default_value => isset($block['region']) ? $block['region'] : system_default_region(), options => $block_regions);
+ $form[$block['module']][$block['delta']]['info'] = array('#type' => 'markup', '#value' => $block['info']);
+ $form[$block['module']][$block['delta']]['status'] = array('#type' => 'checkbox', '#default_value' => $block['status']);
+ $form[$block['module']][$block['delta']]['theme'] = array('#type' => 'hidden', '#value' => $theme_key);
+ $form[$block['module']][$block['delta']]['weight'] = array('#type' => 'weight', '#default_value' => $block['weight']);
+ $form[$block['module']][$block['delta']]['region'] = array('#type' => 'select', '#default_value' => isset($block['region']) ? $block['region'] : system_default_region(), '#options' => $block_regions);
if ($throttle) {
- $form[$block['module']][$block['delta']]['throttle'] = array(type => 'checkbox', default_value => $block['throttle']);
+ $form[$block['module']][$block['delta']]['throttle'] = array('#type' => 'checkbox', '#default_value' => $block['throttle']);
}
- $form[$block['module']][$block['delta']]['configure'] = array(type => 'markup', value => l(t('configure'), 'admin/block/configure/'. $block['module'] .'/'. $block['delta']));
+ $form[$block['module']][$block['delta']]['configure'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/block/configure/'. $block['module'] .'/'. $block['delta']));
if ($block['module'] == 'block') {
- $form[$block['module']][$block['delta']]['delete'] = array(type => 'markup', value => l(t('delete'), 'admin/block/delete/'. $block['delta']));
+ $form[$block['module']][$block['delta']]['delete'] = array('#type' => 'markup', '#value' => l(t('delete'), 'admin/block/delete/'. $block['delta']));
}
}
- $form['submit'] = array(type => 'submit', value => t('Save blocks'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save blocks'));
return drupal_get_form('block_admin_display', $form);
}
@@ -260,10 +260,10 @@ function theme_block_admin_display($form) {
}
$row[] = form_render($block['configure']);
$row[] = $block['delete'] ? form_render($block['delete']) : '';
- if ($block['status'][default_value]) {
- $regions[$block['region'][default_value]][] = $row;
+ if ($block['status']['#default_value']) {
+ $regions[$block['region']['#default_value']][] = $row;
}
- else if ($block['region'][default_value] <= 1) {
+ else if ($block['region']['#default_value'] <= 1) {
$disabled[] = $row;
}
}
@@ -320,11 +320,11 @@ function block_admin_configure($module = NULL, $delta = 0) {
// Module-specific block configurations.
if ($settings = module_invoke($module, 'block', 'configure', $delta)) {
- $form['block_settings'] = array(type => 'fieldset',
- title => t('Block specific settings'),
- collapsible => true,
- collapsed => false,
- weight => 0);
+ $form['block_settings'] = array('#type' => 'fieldset',
+ '#title' => t('Block specific settings'),
+ '#collapsible' => true,
+ '#collapsed' => false,
+ '#weight' => 0);
foreach ($settings as $k => $v) {
$form['block_settings'][$k] = $v;
@@ -337,43 +337,43 @@ function block_admin_configure($module = NULL, $delta = 0) {
// Standard block configurations.
- $form['user_vis_settings'] = array(type => 'fieldset',
- title => t('User specific visibility settings'),
- collapsible => true,
- collapsed => false,
- weight => 0);
+ $form['user_vis_settings'] = array('#type' => 'fieldset',
+ '#title' => t('User specific visibility settings'),
+ '#collapsible' => true,
+ '#collapsed' => false,
+ '#weight' => 0);
$form['user_vis_settings']['custom'] = array(
- type => 'radios',
- title => t('Custom visibility settings'),
- default_value => $edit['custom'],
- options => array(t('Users cannot control whether or not they see this block.'), t('Show this block by default, but let individual users hide it.'), t('Hide this block by default but let individual users show it.')), t('Allow individual users to customize the visibility of this block in their account settings.'),
- default_value => $edit['custom']);
+ '#type' => 'radios',
+ '#title' => t('Custom visibility settings'),
+ '#default_value' => $edit['custom'],
+ '#options' => array(t('Users cannot control whether or not they see this block.'), t('Show this block by default, but let individual users hide it.'), t('Hide this block by default but let individual users show it.')), t('Allow individual users to customize the visibility of this block in their account settings.'),
+ '#default_value' => $edit['custom']);
- $form['page_vis_settings'] = array(type => 'fieldset',
- title => t('Page specific visibility settings'),
- collapsible => true,
- collapsed => false,
- weight => 0);
+ $form['page_vis_settings'] = array('#type' => 'fieldset',
+ '#title' => t('Page specific visibility settings'),
+ '#collapsible' => true,
+ '#collapsed' => false,
+ '#weight' => 0);
$form['page_vis_settings']['visibility'] = array(
- type => 'radios',
- title => t('Show block on specific pages'),
- default_value => $edit['visibility'],
- options => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'), t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).')),
- default_value => $edit['visibility']);
+ '#type' => 'radios',
+ '#title' => t('Show block on specific pages'),
+ '#default_value' => $edit['visibility'],
+ '#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'), t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).')),
+ '#default_value' => $edit['visibility']);
$form['page_vis_settings']['pages'] = array(
- type => 'textarea',
- title => t('Pages'),
- default_value => $edit['pages'],
- cols => 60,
- rows => 5,
- description => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog1 for every personal blog. %front is the front page. If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.", array('%blog' => theme('placeholder', 'blog'), '%blog1' => theme('placeholder', 'blog/*'), '%front' => theme('placeholder', '<front>'), '%php' => theme('placeholder', '<?php ?>'))));
+ '#type' => 'textarea',
+ '#title' => t('Pages'),
+ '#default_value' => $edit['pages'],
+ '#cols' => 60,
+ '#rows' => 5,
+ '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog1 for every personal blog. %front is the front page. If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.", array('%blog' => theme('placeholder', 'blog'), '%blog1' => theme('placeholder', 'blog/*'), '%front' => theme('placeholder', '<front>'), '%php' => theme('placeholder', '<?php ?>'))));
- $form['submit'] = array(type => 'submit', value => t('Save block'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
return drupal_get_form('block_config', $form);
}
@@ -395,7 +395,7 @@ function block_box_add() {
// deliberate no break
default:
$form = block_box_form($edit);
- $form['submit'] = array(type => 'submit', value => t('Save block'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
}
return drupal_get_form('block_box_add', $form);
@@ -406,8 +406,8 @@ function block_box_add() {
*/
function block_box_delete($bid = 0) {
$box = block_box_get($bid);
- $form['info'] = array(type => 'hidden', value => $box['info'] ? $box['info'] : $box['title']);
- $form['bid'] = array(type => 'hidden', value => $bid);
+ $form['info'] = array('#type' => 'hidden', '#value' => $box['info'] ? $box['info'] : $box['title']);
+ $form['bid'] = array('#type' => 'hidden', '#value' => $bid);
return confirm_form('block_box_delete_confirm', $form, t('Are you sure you want to delete the block %name?', array('%name' => theme('placeholder', $info))), 'admin/block', '', t('Delete'), t('Cancel'));
}
@@ -425,10 +425,10 @@ function block_box_delete_confirm_execute($form_id, $edit) {
function block_box_form($edit = array()) {
- $form['title'] = array(type => 'textfield', title => t('Block title'), default_value => $edit['title'], size => 60, maxlength => 64, description => t('The title of the block as shown to the user.'));
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Block title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64, '#description' => t('The title of the block as shown to the user.'));
$form['format'] = filter_form($edit['format']);
- $form['body'] = array(type => 'textarea', title => t('Block body'), default_value => $edit['body'], cols => 60, rows => 15, description => t('The content of the block as shown to the user.'));
- $form['info'] = array(type => 'textfield', title => t('Block description'), default_value => $edit['info'], size => 60, maxlength => 64, description => t('A brief description of your block. Used on the <a href="%overview">block overview page</a>.', array('%overview' => url('admin/block'))), required => TRUE);
+ $form['body'] = array('#type' => 'textarea', '#title' => t('Block body'), '#default_value' => $edit['body'], '#cols' => 60, '#rows' => 15, '#description' => t('The content of the block as shown to the user.'));
+ $form['info'] = array('#type' => 'textfield', '#title' => t('Block description'), '#default_value' => $edit['info'], '#size' => 60, '#maxlength' => 64, '#description' => t('A brief description of your block. Used on the <a href="%overview">block overview page</a>.', array('%overview' => url('admin/block'))), '#required' => TRUE);
return $form;
}
@@ -478,12 +478,12 @@ function block_user($type, $edit, &$user, $category = NULL) {
case 'form':
if ($category == 'account') {
$result = db_query('SELECT * FROM {blocks} WHERE status = 1 AND custom != 0 ORDER BY weight, module, delta');
- $form['block'] = array(type => 'fieldset', title => t('Block configuration'), weight => 3, collapsible => TRUE, collapsed => FALSE, tree => TRUE);
+ $form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE);
while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, 'block', 'list');
if ($data[$block->delta]['info']) {
$return = TRUE;
- $form['block'][$block->module][$block->delta] = array(type => 'checkbox', title => $data[$block->delta]['info'], default_value => isset($user->block[$block->module][$block->delta]) ? $user->block[$block->module][$block->delta] : ($block->custom == 1));
+ $form['block'][$block->module][$block->delta] = array('#type' => 'checkbox', '#title' => $data[$block->delta]['info'], '#default_value' => isset($user->block[$block->module][$block->delta]) ? $user->block[$block->module][$block->delta] : ($block->custom == 1));
}
}
diff --git a/modules/block/block.module b/modules/block/block.module
index 5f95aa80e..333920156 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -207,24 +207,24 @@ function block_admin_display() {
$blocks = _block_rehash();
$block_regions = system_region_list($theme_key);
- $form[action] = arg(3) ? url('admin/block/list/' . $theme_key) : url('admin/block');
- $form[tree] = TRUE;
+ $form['#action'] = arg(3) ? url('admin/block/list/' . $theme_key) : url('admin/block');
+ $form['#tree'] = TRUE;
foreach ($blocks as $block) {
- $form[$block['module']][$block['delta']]['info'] = array(type => 'markup', value => $block['info']);
- $form[$block['module']][$block['delta']]['status'] = array(type => 'checkbox', default_value => $block['status']);
- $form[$block['module']][$block['delta']]['theme'] = array(type => 'hidden', value => $theme_key);
- $form[$block['module']][$block['delta']]['weight'] = array(type => 'weight', default_value => $block['weight']);
- $form[$block['module']][$block['delta']]['region'] = array(type => 'select', default_value => isset($block['region']) ? $block['region'] : system_default_region(), options => $block_regions);
+ $form[$block['module']][$block['delta']]['info'] = array('#type' => 'markup', '#value' => $block['info']);
+ $form[$block['module']][$block['delta']]['status'] = array('#type' => 'checkbox', '#default_value' => $block['status']);
+ $form[$block['module']][$block['delta']]['theme'] = array('#type' => 'hidden', '#value' => $theme_key);
+ $form[$block['module']][$block['delta']]['weight'] = array('#type' => 'weight', '#default_value' => $block['weight']);
+ $form[$block['module']][$block['delta']]['region'] = array('#type' => 'select', '#default_value' => isset($block['region']) ? $block['region'] : system_default_region(), '#options' => $block_regions);
if ($throttle) {
- $form[$block['module']][$block['delta']]['throttle'] = array(type => 'checkbox', default_value => $block['throttle']);
+ $form[$block['module']][$block['delta']]['throttle'] = array('#type' => 'checkbox', '#default_value' => $block['throttle']);
}
- $form[$block['module']][$block['delta']]['configure'] = array(type => 'markup', value => l(t('configure'), 'admin/block/configure/'. $block['module'] .'/'. $block['delta']));
+ $form[$block['module']][$block['delta']]['configure'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/block/configure/'. $block['module'] .'/'. $block['delta']));
if ($block['module'] == 'block') {
- $form[$block['module']][$block['delta']]['delete'] = array(type => 'markup', value => l(t('delete'), 'admin/block/delete/'. $block['delta']));
+ $form[$block['module']][$block['delta']]['delete'] = array('#type' => 'markup', '#value' => l(t('delete'), 'admin/block/delete/'. $block['delta']));
}
}
- $form['submit'] = array(type => 'submit', value => t('Save blocks'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save blocks'));
return drupal_get_form('block_admin_display', $form);
}
@@ -260,10 +260,10 @@ function theme_block_admin_display($form) {
}
$row[] = form_render($block['configure']);
$row[] = $block['delete'] ? form_render($block['delete']) : '';
- if ($block['status'][default_value]) {
- $regions[$block['region'][default_value]][] = $row;
+ if ($block['status']['#default_value']) {
+ $regions[$block['region']['#default_value']][] = $row;
}
- else if ($block['region'][default_value] <= 1) {
+ else if ($block['region']['#default_value'] <= 1) {
$disabled[] = $row;
}
}
@@ -320,11 +320,11 @@ function block_admin_configure($module = NULL, $delta = 0) {
// Module-specific block configurations.
if ($settings = module_invoke($module, 'block', 'configure', $delta)) {
- $form['block_settings'] = array(type => 'fieldset',
- title => t('Block specific settings'),
- collapsible => true,
- collapsed => false,
- weight => 0);
+ $form['block_settings'] = array('#type' => 'fieldset',
+ '#title' => t('Block specific settings'),
+ '#collapsible' => true,
+ '#collapsed' => false,
+ '#weight' => 0);
foreach ($settings as $k => $v) {
$form['block_settings'][$k] = $v;
@@ -337,43 +337,43 @@ function block_admin_configure($module = NULL, $delta = 0) {
// Standard block configurations.
- $form['user_vis_settings'] = array(type => 'fieldset',
- title => t('User specific visibility settings'),
- collapsible => true,
- collapsed => false,
- weight => 0);
+ $form['user_vis_settings'] = array('#type' => 'fieldset',
+ '#title' => t('User specific visibility settings'),
+ '#collapsible' => true,
+ '#collapsed' => false,
+ '#weight' => 0);
$form['user_vis_settings']['custom'] = array(
- type => 'radios',
- title => t('Custom visibility settings'),
- default_value => $edit['custom'],
- options => array(t('Users cannot control whether or not they see this block.'), t('Show this block by default, but let individual users hide it.'), t('Hide this block by default but let individual users show it.')), t('Allow individual users to customize the visibility of this block in their account settings.'),
- default_value => $edit['custom']);
+ '#type' => 'radios',
+ '#title' => t('Custom visibility settings'),
+ '#default_value' => $edit['custom'],
+ '#options' => array(t('Users cannot control whether or not they see this block.'), t('Show this block by default, but let individual users hide it.'), t('Hide this block by default but let individual users show it.')), t('Allow individual users to customize the visibility of this block in their account settings.'),
+ '#default_value' => $edit['custom']);
- $form['page_vis_settings'] = array(type => 'fieldset',
- title => t('Page specific visibility settings'),
- collapsible => true,
- collapsed => false,
- weight => 0);
+ $form['page_vis_settings'] = array('#type' => 'fieldset',
+ '#title' => t('Page specific visibility settings'),
+ '#collapsible' => true,
+ '#collapsed' => false,
+ '#weight' => 0);
$form['page_vis_settings']['visibility'] = array(
- type => 'radios',
- title => t('Show block on specific pages'),
- default_value => $edit['visibility'],
- options => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'), t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).')),
- default_value => $edit['visibility']);
+ '#type' => 'radios',
+ '#title' => t('Show block on specific pages'),
+ '#default_value' => $edit['visibility'],
+ '#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'), t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).')),
+ '#default_value' => $edit['visibility']);
$form['page_vis_settings']['pages'] = array(
- type => 'textarea',
- title => t('Pages'),
- default_value => $edit['pages'],
- cols => 60,
- rows => 5,
- description => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog1 for every personal blog. %front is the front page. If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.", array('%blog' => theme('placeholder', 'blog'), '%blog1' => theme('placeholder', 'blog/*'), '%front' => theme('placeholder', '<front>'), '%php' => theme('placeholder', '<?php ?>'))));
+ '#type' => 'textarea',
+ '#title' => t('Pages'),
+ '#default_value' => $edit['pages'],
+ '#cols' => 60,
+ '#rows' => 5,
+ '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog1 for every personal blog. %front is the front page. If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.", array('%blog' => theme('placeholder', 'blog'), '%blog1' => theme('placeholder', 'blog/*'), '%front' => theme('placeholder', '<front>'), '%php' => theme('placeholder', '<?php ?>'))));
- $form['submit'] = array(type => 'submit', value => t('Save block'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
return drupal_get_form('block_config', $form);
}
@@ -395,7 +395,7 @@ function block_box_add() {
// deliberate no break
default:
$form = block_box_form($edit);
- $form['submit'] = array(type => 'submit', value => t('Save block'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
}
return drupal_get_form('block_box_add', $form);
@@ -406,8 +406,8 @@ function block_box_add() {
*/
function block_box_delete($bid = 0) {
$box = block_box_get($bid);
- $form['info'] = array(type => 'hidden', value => $box['info'] ? $box['info'] : $box['title']);
- $form['bid'] = array(type => 'hidden', value => $bid);
+ $form['info'] = array('#type' => 'hidden', '#value' => $box['info'] ? $box['info'] : $box['title']);
+ $form['bid'] = array('#type' => 'hidden', '#value' => $bid);
return confirm_form('block_box_delete_confirm', $form, t('Are you sure you want to delete the block %name?', array('%name' => theme('placeholder', $info))), 'admin/block', '', t('Delete'), t('Cancel'));
}
@@ -425,10 +425,10 @@ function block_box_delete_confirm_execute($form_id, $edit) {
function block_box_form($edit = array()) {
- $form['title'] = array(type => 'textfield', title => t('Block title'), default_value => $edit['title'], size => 60, maxlength => 64, description => t('The title of the block as shown to the user.'));
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Block title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64, '#description' => t('The title of the block as shown to the user.'));
$form['format'] = filter_form($edit['format']);
- $form['body'] = array(type => 'textarea', title => t('Block body'), default_value => $edit['body'], cols => 60, rows => 15, description => t('The content of the block as shown to the user.'));
- $form['info'] = array(type => 'textfield', title => t('Block description'), default_value => $edit['info'], size => 60, maxlength => 64, description => t('A brief description of your block. Used on the <a href="%overview">block overview page</a>.', array('%overview' => url('admin/block'))), required => TRUE);
+ $form['body'] = array('#type' => 'textarea', '#title' => t('Block body'), '#default_value' => $edit['body'], '#cols' => 60, '#rows' => 15, '#description' => t('The content of the block as shown to the user.'));
+ $form['info'] = array('#type' => 'textfield', '#title' => t('Block description'), '#default_value' => $edit['info'], '#size' => 60, '#maxlength' => 64, '#description' => t('A brief description of your block. Used on the <a href="%overview">block overview page</a>.', array('%overview' => url('admin/block'))), '#required' => TRUE);
return $form;
}
@@ -478,12 +478,12 @@ function block_user($type, $edit, &$user, $category = NULL) {
case 'form':
if ($category == 'account') {
$result = db_query('SELECT * FROM {blocks} WHERE status = 1 AND custom != 0 ORDER BY weight, module, delta');
- $form['block'] = array(type => 'fieldset', title => t('Block configuration'), weight => 3, collapsible => TRUE, collapsed => FALSE, tree => TRUE);
+ $form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE);
while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, 'block', 'list');
if ($data[$block->delta]['info']) {
$return = TRUE;
- $form['block'][$block->module][$block->delta] = array(type => 'checkbox', title => $data[$block->delta]['info'], default_value => isset($user->block[$block->module][$block->delta]) ? $user->block[$block->module][$block->delta] : ($block->custom == 1));
+ $form['block'][$block->module][$block->delta] = array('#type' => 'checkbox', '#title' => $data[$block->delta]['info'], '#default_value' => isset($user->block[$block->module][$block->delta]) ? $user->block[$block->module][$block->delta] : ($block->custom == 1));
}
}
diff --git a/modules/blog.module b/modules/blog.module
index a79a02fb0..7b83a6bd4 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -43,8 +43,8 @@ function blog_access($op, $node) {
function blog_user($type, &$edit, &$user) {
if ($type == 'view' && user_access('edit own blog', $user)) {
$form['blog'] = array(
- type => 'item', title => t('Blog'),
- value => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name))))
+ '#type' => 'item', '#title' => t('Blog'),
+ '#value' => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name))))
);
return array(t('History') => $form);
}
@@ -219,12 +219,8 @@ function blog_form(&$node) {
}
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('blog', $node);
- }
-
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
- $form['body'] = array(type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
+ $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE);
$form = array_merge($form, filter_form($node->format));
return $form;
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index a79a02fb0..7b83a6bd4 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -43,8 +43,8 @@ function blog_access($op, $node) {
function blog_user($type, &$edit, &$user) {
if ($type == 'view' && user_access('edit own blog', $user)) {
$form['blog'] = array(
- type => 'item', title => t('Blog'),
- value => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name))))
+ '#type' => 'item', '#title' => t('Blog'),
+ '#value' => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name))))
);
return array(t('History') => $form);
}
@@ -219,12 +219,8 @@ function blog_form(&$node) {
}
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('blog', $node);
- }
-
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
- $form['body'] = array(type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
+ $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE);
$form = array_merge($form, filter_form($node->format));
return $form;
}
diff --git a/modules/blogapi.module b/modules/blogapi.module
index ef2fc080b..b23de7324 100644
--- a/modules/blogapi.module
+++ b/modules/blogapi.module
@@ -549,17 +549,17 @@ function blogapi_blogger_title(&$contents) {
function blogapi_settings() {
$form['blogapi_engine'] = array(
- type => 'select', title => t('XML-RPC Engine'), default_value => variable_get('blogapi_engine', 0),
- options => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
- description => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
+ '#type' => 'select', '#title' => t('XML-RPC Engine'), '#default_value' => variable_get('blogapi_engine', 0),
+ '#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
+ '#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
);
$node_types = node_get_types();
$defaults = isset($node_types['blog']) ? array('blog') : array();
$form['blogapi_node_types'] = array(
- type => 'checkboxes', title => t('Blog types'), required => TRUE,
- default_value => variable_get('blogapi_node_types', $defaults), options => $node_types,
- description => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
+ '#type' => 'checkboxes', '#title' => t('Blog types'), '#required' => TRUE,
+ '#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types,
+ '#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
);
return $form;
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index ef2fc080b..b23de7324 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -549,17 +549,17 @@ function blogapi_blogger_title(&$contents) {
function blogapi_settings() {
$form['blogapi_engine'] = array(
- type => 'select', title => t('XML-RPC Engine'), default_value => variable_get('blogapi_engine', 0),
- options => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
- description => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
+ '#type' => 'select', '#title' => t('XML-RPC Engine'), '#default_value' => variable_get('blogapi_engine', 0),
+ '#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
+ '#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
);
$node_types = node_get_types();
$defaults = isset($node_types['blog']) ? array('blog') : array();
$form['blogapi_node_types'] = array(
- type => 'checkboxes', title => t('Blog types'), required => TRUE,
- default_value => variable_get('blogapi_node_types', $defaults), options => $node_types,
- description => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
+ '#type' => 'checkboxes', '#title' => t('Blog types'), '#required' => TRUE,
+ '#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types,
+ '#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
);
return $form;
diff --git a/modules/book.module b/modules/book.module
index f61b26490..207675c3c 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -238,35 +238,31 @@ function book_validate(&$node) {
*/
function book_form(&$node) {
$form['parent'] = array(
- type => 'select', title => t('Parent'), default_value => ($node->parent ? $node->parent : arg(4)), options => book_toc($node->nid), weight => -15,
- description => t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.')
+ '#type' => 'select', '#title' => t('Parent'), '#default_value' => ($node->parent ? $node->parent : arg(4)), '#options' => book_toc($node->nid), '#weight' => -15,
+ '#description' => t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.')
);
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('book', $node);
- }
-
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array(
- type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
$form['log'] = array(
- type => 'textarea', title => t('Log message'), default_value => $node->log, rows => 5, weight => 19,
- description => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#rows' => 5, '#weight' => 19,
+ '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
if (user_access('administer nodes')) {
$form['weight'] = array(
- type => 'weight', title => t('Weight'), default_value => $node->weight, delta => 15, weight => -14,
- description => t('Pages at a given level are ordered first by weight and then by title.')
+ '#type' => 'weight', '#title' => t('Weight'), '#default_value' => $node->weight, '#delta' => 15, '#weight' => -14,
+ '#description' => t('Pages at a given level are ordered first by weight and then by title.')
);
}
else {
// If a regular user updates a book page, we create a new revision
// authored by that user:
- $form['revision'] = array(type => 'hidden', value => 1);
+ $form['revision'] = array('#type' => 'hidden', '#value' => 1);
}
return $form;
@@ -308,26 +304,26 @@ function book_outline() {
$page = db_fetch_object(db_query('SELECT * FROM {book} WHERE vid = %d', $node->vid));
$form['parent'] = array(
- type => 'select', title => t('Parent'), default_value => $page->parent,
- options => book_toc($node->nid), description => t('The parent page in the book.')
+ '#type' => 'select', '#title' => t('Parent'), '#default_value' => $page->parent,
+ '#options' => book_toc($node->nid), '#description' => t('The parent page in the book.')
);
$form['weight'] = array(
- type => 'weight', title => t('Weight'), default_value => $page->weight, delta => 15,
- description => t('Pages at a given level are ordered first by weight and then by title.')
+ '#type' => 'weight', '#title' => t('Weight'), '#default_value' => $page->weight, '#delta' => 15,
+ '#description' => t('Pages at a given level are ordered first by weight and then by title.')
);
$form['log'] = array(
- type => 'textarea', title => t('Log message'), cols => 60, rows => 5,
- default_value => $node->log, description => t('An explanation to help other authors understand your motivations to put this post into the book.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#cols' => 60, '#rows' => 5,
+ '#default_value' => $node->log, '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.')
);
if ($page->nid) {
- $form['update'] = array(type => 'submit', value => t('Update book outline'));
- $form['remove'] = array(type => 'submit', value => t('Remove from book outline'));
+ $form['update'] = array('#type' => 'submit', '#value' => t('Update book outline'));
+ $form['remove'] = array('#type' => 'submit', '#value' => t('Remove from book outline'));
}
else {
- $form['add'] = array(type => 'submit', value => t('Add to book outline'));
+ $form['add'] = array('#type' => 'submit', '#value' => t('Add to book outline'));
}
drupal_set_title(check_plain($node->title));
@@ -974,18 +970,18 @@ function book_node_visitor_opml_post($node, $depth) {
* Creates a row for the 'admin' view of a book. Each row represents a page in the book, in the tree representing the book
*/
function book_admin_edit_line($node, $depth = 0) {
- $form[tree] = TRUE;
- $form[$node->nid]['title'] = array(type => 'textfield', default_value => $node->title, size => 60, maxlength => 255);
- $form[$node->nid]['weight'] = array(type => 'weight', default_value => $node->weight, delta => 15);
- $form['depth'] = array(value => $depth);
- $form['nid'] = array(value => $node->nid);
+ $form['#tree'] = TRUE;
+ $form[$node->nid]['title'] = array('#type' => 'textfield', '#default_value' => $node->title, '#size' => 60, '#maxlength' => 255);
+ $form[$node->nid]['weight'] = array('#type' => 'weight', '#default_value' => $node->weight, '#delta' => 15);
+ $form['depth'] = array('#value' => $depth);
+ $form['nid'] = array('#value' => $node->nid);
return drupal_get_form('book_admin_edit_line', $form);
}
function theme_book_admin_edit_line($form) {
- $nid = $form['nid'][value];
+ $nid = $form['nid']['#value'];
return array(
- '<div style="padding-left: '. (25 * $form['depth'][value]) .'px;">'. form_render($form[$nid]['title']) .'</div>', form_render($form[$nid]['weight']), l(t('view'), 'node/'. $nid), l(t('edit'), 'node/'. $nid .'/edit'), l(t('delete'), 'node/'.$nid.'/delete')
+ '<div style="padding-left: '. (25 * $form['depth']['#value']) .'px;">'. form_render($form[$nid]['title']) .'</div>', form_render($form[$nid]['weight']), l(t('view'), 'node/'. $nid), l(t('edit'), 'node/'. $nid .'/edit'), l(t('delete'), 'node/'.$nid.'/delete')
);
}
@@ -1015,7 +1011,7 @@ function book_admin_edit($nid, $depth = 0) {
$rows[] = book_admin_edit_line($node);
$rows = array_merge($rows, book_admin_edit_book($nid));
- $form['save'] = array(type => 'submit', value => t('Save book pages'));
+ $form['save'] = array('#type' => 'submit', '#value' => t('Save book pages'));
return theme('table', $header, $rows) . $form;
}
diff --git a/modules/book/book.module b/modules/book/book.module
index f61b26490..207675c3c 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -238,35 +238,31 @@ function book_validate(&$node) {
*/
function book_form(&$node) {
$form['parent'] = array(
- type => 'select', title => t('Parent'), default_value => ($node->parent ? $node->parent : arg(4)), options => book_toc($node->nid), weight => -15,
- description => t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.')
+ '#type' => 'select', '#title' => t('Parent'), '#default_value' => ($node->parent ? $node->parent : arg(4)), '#options' => book_toc($node->nid), '#weight' => -15,
+ '#description' => t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.')
);
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('book', $node);
- }
-
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array(
- type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
$form['log'] = array(
- type => 'textarea', title => t('Log message'), default_value => $node->log, rows => 5, weight => 19,
- description => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#rows' => 5, '#weight' => 19,
+ '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
if (user_access('administer nodes')) {
$form['weight'] = array(
- type => 'weight', title => t('Weight'), default_value => $node->weight, delta => 15, weight => -14,
- description => t('Pages at a given level are ordered first by weight and then by title.')
+ '#type' => 'weight', '#title' => t('Weight'), '#default_value' => $node->weight, '#delta' => 15, '#weight' => -14,
+ '#description' => t('Pages at a given level are ordered first by weight and then by title.')
);
}
else {
// If a regular user updates a book page, we create a new revision
// authored by that user:
- $form['revision'] = array(type => 'hidden', value => 1);
+ $form['revision'] = array('#type' => 'hidden', '#value' => 1);
}
return $form;
@@ -308,26 +304,26 @@ function book_outline() {
$page = db_fetch_object(db_query('SELECT * FROM {book} WHERE vid = %d', $node->vid));
$form['parent'] = array(
- type => 'select', title => t('Parent'), default_value => $page->parent,
- options => book_toc($node->nid), description => t('The parent page in the book.')
+ '#type' => 'select', '#title' => t('Parent'), '#default_value' => $page->parent,
+ '#options' => book_toc($node->nid), '#description' => t('The parent page in the book.')
);
$form['weight'] = array(
- type => 'weight', title => t('Weight'), default_value => $page->weight, delta => 15,
- description => t('Pages at a given level are ordered first by weight and then by title.')
+ '#type' => 'weight', '#title' => t('Weight'), '#default_value' => $page->weight, '#delta' => 15,
+ '#description' => t('Pages at a given level are ordered first by weight and then by title.')
);
$form['log'] = array(
- type => 'textarea', title => t('Log message'), cols => 60, rows => 5,
- default_value => $node->log, description => t('An explanation to help other authors understand your motivations to put this post into the book.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#cols' => 60, '#rows' => 5,
+ '#default_value' => $node->log, '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.')
);
if ($page->nid) {
- $form['update'] = array(type => 'submit', value => t('Update book outline'));
- $form['remove'] = array(type => 'submit', value => t('Remove from book outline'));
+ $form['update'] = array('#type' => 'submit', '#value' => t('Update book outline'));
+ $form['remove'] = array('#type' => 'submit', '#value' => t('Remove from book outline'));
}
else {
- $form['add'] = array(type => 'submit', value => t('Add to book outline'));
+ $form['add'] = array('#type' => 'submit', '#value' => t('Add to book outline'));
}
drupal_set_title(check_plain($node->title));
@@ -974,18 +970,18 @@ function book_node_visitor_opml_post($node, $depth) {
* Creates a row for the 'admin' view of a book. Each row represents a page in the book, in the tree representing the book
*/
function book_admin_edit_line($node, $depth = 0) {
- $form[tree] = TRUE;
- $form[$node->nid]['title'] = array(type => 'textfield', default_value => $node->title, size => 60, maxlength => 255);
- $form[$node->nid]['weight'] = array(type => 'weight', default_value => $node->weight, delta => 15);
- $form['depth'] = array(value => $depth);
- $form['nid'] = array(value => $node->nid);
+ $form['#tree'] = TRUE;
+ $form[$node->nid]['title'] = array('#type' => 'textfield', '#default_value' => $node->title, '#size' => 60, '#maxlength' => 255);
+ $form[$node->nid]['weight'] = array('#type' => 'weight', '#default_value' => $node->weight, '#delta' => 15);
+ $form['depth'] = array('#value' => $depth);
+ $form['nid'] = array('#value' => $node->nid);
return drupal_get_form('book_admin_edit_line', $form);
}
function theme_book_admin_edit_line($form) {
- $nid = $form['nid'][value];
+ $nid = $form['nid']['#value'];
return array(
- '<div style="padding-left: '. (25 * $form['depth'][value]) .'px;">'. form_render($form[$nid]['title']) .'</div>', form_render($form[$nid]['weight']), l(t('view'), 'node/'. $nid), l(t('edit'), 'node/'. $nid .'/edit'), l(t('delete'), 'node/'.$nid.'/delete')
+ '<div style="padding-left: '. (25 * $form['depth']['#value']) .'px;">'. form_render($form[$nid]['title']) .'</div>', form_render($form[$nid]['weight']), l(t('view'), 'node/'. $nid), l(t('edit'), 'node/'. $nid .'/edit'), l(t('delete'), 'node/'.$nid.'/delete')
);
}
@@ -1015,7 +1011,7 @@ function book_admin_edit($nid, $depth = 0) {
$rows[] = book_admin_edit_line($node);
$rows = array_merge($rows, book_admin_edit_book($nid));
- $form['save'] = array(type => 'submit', value => t('Save book pages'));
+ $form['save'] = array('#type' => 'submit', '#value' => t('Save book pages'));
return theme('table', $header, $rows) . $form;
}
diff --git a/modules/comment.module b/modules/comment.module
index 3be3ef28d..ecc891e7e 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -204,7 +204,7 @@ function comment_link($type, $node = 0, $main = 0) {
function comment_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
- $form['comment_'. $node->type] = array(type => 'radios', title => t('Default comment setting'), default_value => variable_get('comment_'. $node->type, 2), options => array(t('Disabled'), t('Read only'), t('Read/Write')), description => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
+ $form['comment_'. $node->type] = array('#type' => 'radios', '#title' => t('Default comment setting'), '#default_value' => variable_get('comment_'. $node->type, 2), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
return $form;
case 'fields':
return array('comment');
@@ -212,8 +212,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
case 'form':
if (user_access('administer comments')) {
$selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2);
- $form['user_comments'] = array(type => 'fieldset', title => t('User Comments'), collapsible => TRUE, collapsed => TRUE);
- $form['user_comments']['comment'] = array(type => 'radios', parents => array('comment'), default_value => $selected, options => array(t('Disabled'), t('Read only'), t('Read/Write')));
+ $form['user_comments'] = array('#type' => 'fieldset', '#title' => t('User Comments'), '#collapsible' => TRUE, '#collapsed' => TRUE);
+ $form['user_comments']['comment'] = array('#type' => 'radios', '#parents' => array('comment'), '#default_value' => $selected, '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')));
return $form;
}
break;
@@ -261,8 +261,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
function comment_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
// when user tries to edit his own data
- $form['comment_settings'] = array(type => 'fieldset', title => t('Comment settings'), collapsible => TRUE, collapsed => FALSE, weight => 4);
- $form['comment_settings']['signature'] = array(type => 'textarea', title => t('Signature'), default_value => $edit['comment_settings']['signature'], cols => 60, rows => 5, description => ('Your signature will be publicly displayed at the end of your comments.'));
+ $form['comment_settings'] = array('#type' => 'fieldset', '#title' => t('Comment settings'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#weight' => 4);
+ $form['comment_settings']['signature'] = array('#type' => 'textarea', '#title' => t('Signature'), '#default_value' => $edit['comment_settings']['signature'], '#cols' => 60, '#rows' => 5, '#description' => ('Your signature will be publicly displayed at the end of your comments.'));
return $form;
}
@@ -272,37 +272,37 @@ function comment_user($type, $edit, &$user, $category = NULL) {
* Menu callback; presents the comment settings page.
*/
function comment_configure() {
- $form['viewing_options'] = array(type => 'fieldset', title => t('Comment viewing options'), collapsible => TRUE, collapsed => TRUE, weight => 0);
+ $form['viewing_options'] = array('#type' => 'fieldset', '#title' => t('Comment viewing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 0);
- $form['viewing_options']['comment_default_mode'] = array(type => 'radios', title => t('Default display mode'), default_value => variable_get('comment_default_mode', 4), options => _comment_get_modes(), description => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'));
+ $form['viewing_options']['comment_default_mode'] = array('#type' => 'radios', '#title' => t('Default display mode'), '#default_value' => variable_get('comment_default_mode', 4), '#options' => _comment_get_modes(), '#description' => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'));
- $form['viewing_options']['comment_default_order'] = array(type => 'radios', title => t('Default display order'), default_value => variable_get('Default display order', 1), options => _comment_get_orders(), description => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'));
+ $form['viewing_options']['comment_default_order'] = array('#type' => 'radios', '#title' => t('Default display order'), '#default_value' => variable_get('Default display order', 1), '#options' => _comment_get_orders(), '#description' => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'));
$form['viewing_options']['comment_default_per_page'] = array(
- type => 'select',
- title => t('Default comments per page'),
- default_value => variable_get('comment_default_per_page', 50),
- options => _comment_per_page(),
- description => t('Default number of comments for each page: more comments are distributed in several pages.')
+ '#type' => 'select',
+ '#title' => t('Default comments per page'),
+ '#default_value' => variable_get('comment_default_per_page', 50),
+ '#options' => _comment_per_page(),
+ '#description' => t('Default number of comments for each page: more comments are distributed in several pages.')
);
- $form['viewing_options']['comment_controls'] = array(type => 'radios', title => t('Comment controls'), default_value => variable_get('comment_controls', 3), options => array(t('Display above the comments'), t('Display below the comments'), t('Display above and below the comments'), t('Do not display')), description => t('Position of the comment controls box. The comment controls let the user change the default display mode and display order of comments.'));
+ $form['viewing_options']['comment_controls'] = array('#type' => 'radios', '#title' => t('Comment controls'), '#default_value' => variable_get('comment_controls', 3), '#options' => array(t('Display above the comments'), t('Display below the comments'), t('Display above and below the comments'), t('Do not display')), '#description' => t('Position of the comment controls box. The comment controls let the user change the default display mode and display order of comments.'));
- $form['posting_settings'] = array(type => 'fieldset', title => t('Comment posting settings'), collapsible => true, collapsed => true, weight => 0);
+ $form['posting_settings'] = array('#type' => 'fieldset', '#title' => t('Comment posting settings'), '#collapsible' => true, '#collapsed' => true, '#weight' => 0);
- $form['posting_settings']['comment_anonymous'] = array(type => 'radios', title => t('Comment controls'), default_value => variable_get('comment_anonymous', 1), options => array(t('Anonymous posters may not enter their contact information'), t('Anonymous posters may leave their contact information'), t('Anonymous posters must leave their contact information')),description => t('This feature is only useful if you allow anonymous users to post comments. See the <a href="%url">permissions page</a>.', array('%url' => url('admin/access/permissions'))));
+ $form['posting_settings']['comment_anonymous'] = array('#type' => 'radios', '#title' => t('Comment controls'), '#default_value' => variable_get('comment_anonymous', 1), '#options' => array(t('Anonymous posters may not enter their contact information'), t('Anonymous posters may leave their contact information'), t('Anonymous posters must leave their contact information')),'#description' => t('This feature is only useful if you allow anonymous users to post comments. See the <a href="%url">permissions page</a>.', array('%url' => url('admin/access/permissions'))));
$form['posting_settings']['comment_subject_field'] = array(
- type => 'radios',
- title => t('Comment subject field'),
- default_value => variable_get('comment_subject_field', 1),
- options => array(t('Disabled'), t('Enabled')),
- description => t('Can users provide a unique subject for their comments?')
+ '#type' => 'radios',
+ '#title' => t('Comment subject field'),
+ '#default_value' => variable_get('comment_subject_field', 1),
+ '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t('Can users provide a unique subject for their comments?')
);
- $form['posting_settings']['comment_preview'] = array(type => 'radios', title => t('Preview comment'), default_value => variable_get('comment_preview', 1), options => array(t('Optional'), t('Required')));
+ $form['posting_settings']['comment_preview'] = array('#type' => 'radios', '#title' => t('Preview comment'), '#default_value' => variable_get('comment_preview', 1), '#options' => array(t('Optional'), t('Required')));
- $form['posting_settings']['comment_form_location'] = array(type => 'radios', title => t('Location of comment submission form'), default_value => variable_get('comment_form_location', 0), options => array(t('Display on separate page'), t('Display below post or comments')));
+ $form['posting_settings']['comment_form_location'] = array('#type' => 'radios', '#title' => t('Location of comment submission form'), '#default_value' => variable_get('comment_form_location', 0), '#options' => array(t('Display on separate page'), t('Display below post or comments')));
return system_settings_form('comment_settings_form', $form);
}
@@ -1088,65 +1088,65 @@ function comment_form($edit, $title = NULL) {
$date = format_date($edit['timestamp'], 'custom', 'Y-m-d H:i O');
}
- $form['admin'] = array(type => 'fieldset', title => t('Administration'), collapsible => TRUE, collapsed => TRUE, weight => -2);
+ $form['admin'] = array('#type' => 'fieldset', '#title' => t('Administration'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -2);
- $form['admin']['author'] = array(type => 'textfield', parents => array('author'), title => t('Authored by'), size => 30, maxlength => 60, autocomplete_path => 'user/autocomplete', default_value => $author, weight => -1);
+ $form['admin']['author'] = array('#type' => 'textfield', '#parents' => array('author'), '#title' => t('Authored by'), '#size' => 30, '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $author, '#weight' => -1);
- $form['admin']['date'] = array(type => 'textfield', parents => array('date'), title => t('Authored on'), size => 20, maxlength => 25, default_value => $date, weight => -1);
+ $form['admin']['date'] = array('#type' => 'textfield', '#parents' => array('date'), '#title' => t('Authored on'), '#size' => 20, '#maxlength' => 25, '#default_value' => $date, '#weight' => -1);
- $form['admin']['status'] = array(type => 'radios', parents => array('status'), title => t('Status'), default_value => $status, options => array(t('Published'), t('Not published')), weight => -1);
+ $form['admin']['status'] = array('#type' => 'radios', '#parents' => array('status'), '#title' => t('Status'), '#default_value' => $status, '#options' => array(t('Published'), t('Not published')), '#weight' => -1);
}
else {
- $form['author'] = array(type => 'item', title => t('Your name'), value => theme('username', $user)
+ $form['author'] = array('#type' => 'item', '#title' => t('Your name'), '#value' => theme('username', $user)
);
}
}
else if (variable_get('comment_anonymous', 1) == 2) {
- $form['name'] = array(type => 'textfield', title => t('Your name'), maxlength => 60, size => 30, default_value => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous')
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous')
);
- $form['mail'] = array(type => 'textfield', title => t('E-mail'), maxlength => 64, size => 30, default_value => $edit['mail'], description => t('The content of this field is kept private and will not be shown publicly.')
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.')
);
- $form['homepage'] = array(type => 'textfield', title => t('Homepage'), maxlength => 255, size => 30, default_value => $edit['homepage']);
+ $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
}
else if (variable_get('comment_anonymous', 1) == 3) {
- $form['name'] = array(type => 'textfield', title => t('Your name'), maxlength => 60, size => 30, default_value => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous'), '#required' => TRUE);
- $form['name'] = array(type => 'textfield', title => t('E-mail'), maxlength => 64, size => 30, default_value => $edit['mail'],description => t('The content of this field is kept private and will not be shown publicly.'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'],'#description' => t('The content of this field is kept private and will not be shown publicly.'), '#required' => TRUE);
- $form['homepage'] = array(type => 'textfield', title => t('Homepage'), maxlength => 255, size => 30, default_value => $edit['homepage']);
+ $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
}
if (variable_get('comment_subject_field', 1) == 1) {
- $form['subject'] = array(type => 'textfield', title => t('Subject'), size => 60, maxlength => 64, default_value => $edit['subject']);
+ $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 60, '#maxlength' => 64, '#default_value' => $edit['subject']);
}
- $form['comment'] = array(type => 'textarea', title => t('Comment'), cols => 60, rows => 15, default_value => $edit['comment'] ? $edit['comment'] : $user->signature, required => TRUE
+ $form['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#cols' => 60, '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
- $form['cid'] = array(type => 'hidden', value => $edit['cid']);
- $form['pid'] = array(type => 'hidden', value => $edit['pid']);
- $form['nid'] = array(type => 'hidden', value => $edit['nid']);
- $form['uid'] = array(type => 'hidden', value => $edit['uid']);
+ $form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']);
+ $form['pid'] = array('#type' => 'hidden', '#value' => $edit['pid']);
+ $form['nid'] = array('#type' => 'hidden', '#value' => $edit['nid']);
+ $form['uid'] = array('#type' => 'hidden', '#value' => $edit['uid']);
- $form['preview'] = array(type => 'submit', value => t('Preview comment'), weight => 19);
- $form[token] = 'comment' . $edit['nid'] . $edit['pid'];
+ $form['preview'] = array('#type' => 'submit', '#value' => t('Preview comment'), '#weight' => 19);
+ $form['#token'] = 'comment' . $edit['nid'] . $edit['pid'];
// Only show post button if preview is optional or if we are in preview mode.
// We show the post button in preview mode even if there are form errors so that
// optional form elements (e.g., captcha) can be updated in preview mode.
if ((variable_get('comment_preview', 1) == 0) || ($_POST['op'] == t('Preview comment')) || ($_POST['op'] == t('Post comment'))) {
- $form['submit'] = array(type => 'submit', value => t('Post comment'), weight => 20);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Post comment'), '#weight' => 20);
}
if ($_REQUEST['destination']) {
- $form[attributes]['destination'] = $_REQUEST['destination'];
+ $form['#attributes']['destination'] = $_REQUEST['destination'];
}
- $form[action] = url('comment/reply/'. $edit['nid']);
+ $form['#action'] = url('comment/reply/'. $edit['nid']);
// Graft in extra form additions
$form = array_merge($form, comment_invoke_comment($form, 'form'));
@@ -1198,20 +1198,20 @@ function theme_comment_view($comment, $links = '', $visible = 1) {
function comment_controls($mode = 2, $order = 1, $comments_per_page = 50, $nid = 0, $top_or_bottom = '') {
- $form['mode'] = array(type => 'select', default_value => $mode, options => _comment_get_modes(), weight => 1);
+ $form['mode'] = array('#type' => 'select', '#default_value' => $mode, '#options' => _comment_get_modes(), '#weight' => 1);
- $form['order'] = array(type => 'select', default_value => $order, options => _comment_get_orders(), weight => 2);
+ $form['order'] = array('#type' => 'select', '#default_value' => $order, '#options' => _comment_get_orders(), '#weight' => 2);
foreach (_comment_per_page() as $i) {
$options[] = t('%a comments per page', array('%a' => $i));
}
- $form['comments_per_page'] = array(type => 'select', default_value => $comments_per_page, options => $options, weight => 3);
+ $form['comments_per_page'] = array('#type' => 'select', '#default_value' => $comments_per_page, '#options' => $options, '#weight' => 3);
- $form['submit'] = array(type => 'submit', value => t('Save settings'), weight => 20);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save settings'), '#weight' => 20);
- $form['nid'] = array(type => 'hidden', value => $nid);
+ $form['nid'] = array('#type' => 'hidden', '#value' => $nid);
- $form[action] = 'comment/reply';
+ $form['#action'] = 'comment/reply';
return drupal_get_form('comment_controls'. $top_or_bottom, $form, 'comment_controls');
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 3be3ef28d..ecc891e7e 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -204,7 +204,7 @@ function comment_link($type, $node = 0, $main = 0) {
function comment_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
- $form['comment_'. $node->type] = array(type => 'radios', title => t('Default comment setting'), default_value => variable_get('comment_'. $node->type, 2), options => array(t('Disabled'), t('Read only'), t('Read/Write')), description => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
+ $form['comment_'. $node->type] = array('#type' => 'radios', '#title' => t('Default comment setting'), '#default_value' => variable_get('comment_'. $node->type, 2), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
return $form;
case 'fields':
return array('comment');
@@ -212,8 +212,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
case 'form':
if (user_access('administer comments')) {
$selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2);
- $form['user_comments'] = array(type => 'fieldset', title => t('User Comments'), collapsible => TRUE, collapsed => TRUE);
- $form['user_comments']['comment'] = array(type => 'radios', parents => array('comment'), default_value => $selected, options => array(t('Disabled'), t('Read only'), t('Read/Write')));
+ $form['user_comments'] = array('#type' => 'fieldset', '#title' => t('User Comments'), '#collapsible' => TRUE, '#collapsed' => TRUE);
+ $form['user_comments']['comment'] = array('#type' => 'radios', '#parents' => array('comment'), '#default_value' => $selected, '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')));
return $form;
}
break;
@@ -261,8 +261,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
function comment_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
// when user tries to edit his own data
- $form['comment_settings'] = array(type => 'fieldset', title => t('Comment settings'), collapsible => TRUE, collapsed => FALSE, weight => 4);
- $form['comment_settings']['signature'] = array(type => 'textarea', title => t('Signature'), default_value => $edit['comment_settings']['signature'], cols => 60, rows => 5, description => ('Your signature will be publicly displayed at the end of your comments.'));
+ $form['comment_settings'] = array('#type' => 'fieldset', '#title' => t('Comment settings'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#weight' => 4);
+ $form['comment_settings']['signature'] = array('#type' => 'textarea', '#title' => t('Signature'), '#default_value' => $edit['comment_settings']['signature'], '#cols' => 60, '#rows' => 5, '#description' => ('Your signature will be publicly displayed at the end of your comments.'));
return $form;
}
@@ -272,37 +272,37 @@ function comment_user($type, $edit, &$user, $category = NULL) {
* Menu callback; presents the comment settings page.
*/
function comment_configure() {
- $form['viewing_options'] = array(type => 'fieldset', title => t('Comment viewing options'), collapsible => TRUE, collapsed => TRUE, weight => 0);
+ $form['viewing_options'] = array('#type' => 'fieldset', '#title' => t('Comment viewing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 0);
- $form['viewing_options']['comment_default_mode'] = array(type => 'radios', title => t('Default display mode'), default_value => variable_get('comment_default_mode', 4), options => _comment_get_modes(), description => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'));
+ $form['viewing_options']['comment_default_mode'] = array('#type' => 'radios', '#title' => t('Default display mode'), '#default_value' => variable_get('comment_default_mode', 4), '#options' => _comment_get_modes(), '#description' => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'));
- $form['viewing_options']['comment_default_order'] = array(type => 'radios', title => t('Default display order'), default_value => variable_get('Default display order', 1), options => _comment_get_orders(), description => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'));
+ $form['viewing_options']['comment_default_order'] = array('#type' => 'radios', '#title' => t('Default display order'), '#default_value' => variable_get('Default display order', 1), '#options' => _comment_get_orders(), '#description' => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'));
$form['viewing_options']['comment_default_per_page'] = array(
- type => 'select',
- title => t('Default comments per page'),
- default_value => variable_get('comment_default_per_page', 50),
- options => _comment_per_page(),
- description => t('Default number of comments for each page: more comments are distributed in several pages.')
+ '#type' => 'select',
+ '#title' => t('Default comments per page'),
+ '#default_value' => variable_get('comment_default_per_page', 50),
+ '#options' => _comment_per_page(),
+ '#description' => t('Default number of comments for each page: more comments are distributed in several pages.')
);
- $form['viewing_options']['comment_controls'] = array(type => 'radios', title => t('Comment controls'), default_value => variable_get('comment_controls', 3), options => array(t('Display above the comments'), t('Display below the comments'), t('Display above and below the comments'), t('Do not display')), description => t('Position of the comment controls box. The comment controls let the user change the default display mode and display order of comments.'));
+ $form['viewing_options']['comment_controls'] = array('#type' => 'radios', '#title' => t('Comment controls'), '#default_value' => variable_get('comment_controls', 3), '#options' => array(t('Display above the comments'), t('Display below the comments'), t('Display above and below the comments'), t('Do not display')), '#description' => t('Position of the comment controls box. The comment controls let the user change the default display mode and display order of comments.'));
- $form['posting_settings'] = array(type => 'fieldset', title => t('Comment posting settings'), collapsible => true, collapsed => true, weight => 0);
+ $form['posting_settings'] = array('#type' => 'fieldset', '#title' => t('Comment posting settings'), '#collapsible' => true, '#collapsed' => true, '#weight' => 0);
- $form['posting_settings']['comment_anonymous'] = array(type => 'radios', title => t('Comment controls'), default_value => variable_get('comment_anonymous', 1), options => array(t('Anonymous posters may not enter their contact information'), t('Anonymous posters may leave their contact information'), t('Anonymous posters must leave their contact information')),description => t('This feature is only useful if you allow anonymous users to post comments. See the <a href="%url">permissions page</a>.', array('%url' => url('admin/access/permissions'))));
+ $form['posting_settings']['comment_anonymous'] = array('#type' => 'radios', '#title' => t('Comment controls'), '#default_value' => variable_get('comment_anonymous', 1), '#options' => array(t('Anonymous posters may not enter their contact information'), t('Anonymous posters may leave their contact information'), t('Anonymous posters must leave their contact information')),'#description' => t('This feature is only useful if you allow anonymous users to post comments. See the <a href="%url">permissions page</a>.', array('%url' => url('admin/access/permissions'))));
$form['posting_settings']['comment_subject_field'] = array(
- type => 'radios',
- title => t('Comment subject field'),
- default_value => variable_get('comment_subject_field', 1),
- options => array(t('Disabled'), t('Enabled')),
- description => t('Can users provide a unique subject for their comments?')
+ '#type' => 'radios',
+ '#title' => t('Comment subject field'),
+ '#default_value' => variable_get('comment_subject_field', 1),
+ '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t('Can users provide a unique subject for their comments?')
);
- $form['posting_settings']['comment_preview'] = array(type => 'radios', title => t('Preview comment'), default_value => variable_get('comment_preview', 1), options => array(t('Optional'), t('Required')));
+ $form['posting_settings']['comment_preview'] = array('#type' => 'radios', '#title' => t('Preview comment'), '#default_value' => variable_get('comment_preview', 1), '#options' => array(t('Optional'), t('Required')));
- $form['posting_settings']['comment_form_location'] = array(type => 'radios', title => t('Location of comment submission form'), default_value => variable_get('comment_form_location', 0), options => array(t('Display on separate page'), t('Display below post or comments')));
+ $form['posting_settings']['comment_form_location'] = array('#type' => 'radios', '#title' => t('Location of comment submission form'), '#default_value' => variable_get('comment_form_location', 0), '#options' => array(t('Display on separate page'), t('Display below post or comments')));
return system_settings_form('comment_settings_form', $form);
}
@@ -1088,65 +1088,65 @@ function comment_form($edit, $title = NULL) {
$date = format_date($edit['timestamp'], 'custom', 'Y-m-d H:i O');
}
- $form['admin'] = array(type => 'fieldset', title => t('Administration'), collapsible => TRUE, collapsed => TRUE, weight => -2);
+ $form['admin'] = array('#type' => 'fieldset', '#title' => t('Administration'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -2);
- $form['admin']['author'] = array(type => 'textfield', parents => array('author'), title => t('Authored by'), size => 30, maxlength => 60, autocomplete_path => 'user/autocomplete', default_value => $author, weight => -1);
+ $form['admin']['author'] = array('#type' => 'textfield', '#parents' => array('author'), '#title' => t('Authored by'), '#size' => 30, '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $author, '#weight' => -1);
- $form['admin']['date'] = array(type => 'textfield', parents => array('date'), title => t('Authored on'), size => 20, maxlength => 25, default_value => $date, weight => -1);
+ $form['admin']['date'] = array('#type' => 'textfield', '#parents' => array('date'), '#title' => t('Authored on'), '#size' => 20, '#maxlength' => 25, '#default_value' => $date, '#weight' => -1);
- $form['admin']['status'] = array(type => 'radios', parents => array('status'), title => t('Status'), default_value => $status, options => array(t('Published'), t('Not published')), weight => -1);
+ $form['admin']['status'] = array('#type' => 'radios', '#parents' => array('status'), '#title' => t('Status'), '#default_value' => $status, '#options' => array(t('Published'), t('Not published')), '#weight' => -1);
}
else {
- $form['author'] = array(type => 'item', title => t('Your name'), value => theme('username', $user)
+ $form['author'] = array('#type' => 'item', '#title' => t('Your name'), '#value' => theme('username', $user)
);
}
}
else if (variable_get('comment_anonymous', 1) == 2) {
- $form['name'] = array(type => 'textfield', title => t('Your name'), maxlength => 60, size => 30, default_value => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous')
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous')
);
- $form['mail'] = array(type => 'textfield', title => t('E-mail'), maxlength => 64, size => 30, default_value => $edit['mail'], description => t('The content of this field is kept private and will not be shown publicly.')
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.')
);
- $form['homepage'] = array(type => 'textfield', title => t('Homepage'), maxlength => 255, size => 30, default_value => $edit['homepage']);
+ $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
}
else if (variable_get('comment_anonymous', 1) == 3) {
- $form['name'] = array(type => 'textfield', title => t('Your name'), maxlength => 60, size => 30, default_value => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous'), '#required' => TRUE);
- $form['name'] = array(type => 'textfield', title => t('E-mail'), maxlength => 64, size => 30, default_value => $edit['mail'],description => t('The content of this field is kept private and will not be shown publicly.'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'],'#description' => t('The content of this field is kept private and will not be shown publicly.'), '#required' => TRUE);
- $form['homepage'] = array(type => 'textfield', title => t('Homepage'), maxlength => 255, size => 30, default_value => $edit['homepage']);
+ $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
}
if (variable_get('comment_subject_field', 1) == 1) {
- $form['subject'] = array(type => 'textfield', title => t('Subject'), size => 60, maxlength => 64, default_value => $edit['subject']);
+ $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 60, '#maxlength' => 64, '#default_value' => $edit['subject']);
}
- $form['comment'] = array(type => 'textarea', title => t('Comment'), cols => 60, rows => 15, default_value => $edit['comment'] ? $edit['comment'] : $user->signature, required => TRUE
+ $form['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#cols' => 60, '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
- $form['cid'] = array(type => 'hidden', value => $edit['cid']);
- $form['pid'] = array(type => 'hidden', value => $edit['pid']);
- $form['nid'] = array(type => 'hidden', value => $edit['nid']);
- $form['uid'] = array(type => 'hidden', value => $edit['uid']);
+ $form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']);
+ $form['pid'] = array('#type' => 'hidden', '#value' => $edit['pid']);
+ $form['nid'] = array('#type' => 'hidden', '#value' => $edit['nid']);
+ $form['uid'] = array('#type' => 'hidden', '#value' => $edit['uid']);
- $form['preview'] = array(type => 'submit', value => t('Preview comment'), weight => 19);
- $form[token] = 'comment' . $edit['nid'] . $edit['pid'];
+ $form['preview'] = array('#type' => 'submit', '#value' => t('Preview comment'), '#weight' => 19);
+ $form['#token'] = 'comment' . $edit['nid'] . $edit['pid'];
// Only show post button if preview is optional or if we are in preview mode.
// We show the post button in preview mode even if there are form errors so that
// optional form elements (e.g., captcha) can be updated in preview mode.
if ((variable_get('comment_preview', 1) == 0) || ($_POST['op'] == t('Preview comment')) || ($_POST['op'] == t('Post comment'))) {
- $form['submit'] = array(type => 'submit', value => t('Post comment'), weight => 20);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Post comment'), '#weight' => 20);
}
if ($_REQUEST['destination']) {
- $form[attributes]['destination'] = $_REQUEST['destination'];
+ $form['#attributes']['destination'] = $_REQUEST['destination'];
}
- $form[action] = url('comment/reply/'. $edit['nid']);
+ $form['#action'] = url('comment/reply/'. $edit['nid']);
// Graft in extra form additions
$form = array_merge($form, comment_invoke_comment($form, 'form'));
@@ -1198,20 +1198,20 @@ function theme_comment_view($comment, $links = '', $visible = 1) {
function comment_controls($mode = 2, $order = 1, $comments_per_page = 50, $nid = 0, $top_or_bottom = '') {
- $form['mode'] = array(type => 'select', default_value => $mode, options => _comment_get_modes(), weight => 1);
+ $form['mode'] = array('#type' => 'select', '#default_value' => $mode, '#options' => _comment_get_modes(), '#weight' => 1);
- $form['order'] = array(type => 'select', default_value => $order, options => _comment_get_orders(), weight => 2);
+ $form['order'] = array('#type' => 'select', '#default_value' => $order, '#options' => _comment_get_orders(), '#weight' => 2);
foreach (_comment_per_page() as $i) {
$options[] = t('%a comments per page', array('%a' => $i));
}
- $form['comments_per_page'] = array(type => 'select', default_value => $comments_per_page, options => $options, weight => 3);
+ $form['comments_per_page'] = array('#type' => 'select', '#default_value' => $comments_per_page, '#options' => $options, '#weight' => 3);
- $form['submit'] = array(type => 'submit', value => t('Save settings'), weight => 20);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save settings'), '#weight' => 20);
- $form['nid'] = array(type => 'hidden', value => $nid);
+ $form['nid'] = array('#type' => 'hidden', '#value' => $nid);
- $form[action] = 'comment/reply';
+ $form['#action'] = 'comment/reply';
return drupal_get_form('comment_controls'. $top_or_bottom, $form, 'comment_controls');
}
diff --git a/modules/contact.module b/modules/contact.module
index fa49ab317..91ee383ef 100644
--- a/modules/contact.module
+++ b/modules/contact.module
@@ -59,9 +59,9 @@ function contact_menu($may_cache) {
*/
function contact_settings() {
$form['contact_form_information'] = array(
- type => 'textarea', title => t('Additional information'), cols => 60, rows => 5,
- default_value => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')),
- description => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact')))
+ '#type' => 'textarea', '#title' => t('Additional information'), '#cols' => 60, '#rows' => 5,
+ '#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')),
+ '#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact')))
);
return $form;
}
@@ -73,8 +73,8 @@ function contact_settings() {
*/
function contact_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
- $form['contact'] = array(type => 'fieldset', title => t('Contact settings'), weight => 5, collapsible => TRUE, collapsed => FALSE);
- $form['contact']['contact'] = array(type => 'checkbox', title => t('Personal contact form'), return_value => 1, default_value => $edit['contact'], description => t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('%url' => url("user/$user->uid/contact"))));
+ $form['contact'] = array('#type' => 'fieldset', '#title' => t('Contact settings'), '#weight' => 5, '#collapsible' => TRUE, '#collapsed' => FALSE);
+ $form['contact']['contact'] = array('#type' => 'checkbox', '#title' => t('Personal contact form'), '#return_value' => 1, '#default_value' => $edit['contact'], '#description' => t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('%url' => url("user/$user->uid/contact"))));
return $form;
//return array(array('title' => t('Contact settings'), 'data' => drupal_get_form('contact_user', $form), 'weight' => 2));
}
@@ -102,13 +102,13 @@ function contact_mail_user() {
else {
drupal_set_title($account->name);
- $form[token] = $user->name . $user->mail;
- $form['from'] = array(type => 'item', title => t('From'), value => $user->name .' &lt;'. $user->mail .'&gt;');
- $form['to'] = array(type => 'item', title => t('To'), value => $account->name);
- $form['subject'] = array(type => 'textfield', title => t('Subject'), size => 60, maxlength => 50, required => TRUE);
- $form['message'] = array(type => 'textarea', title => t('Message'), cols => 60, rows => 15, required => TRUE);
- $form['copy'] = array(type => 'checkbox', title => ('Send me a copy.'));
- $form['submit'] = array(type => 'submit', value => t('Send e-mail'));
+ $form['#token'] = $user->name . $user->mail;
+ $form['from'] = array('#type' => 'item', '#title' => t('From'), '#value' => $user->name .' &lt;'. $user->mail .'&gt;');
+ $form['to'] = array('#type' => 'item', '#title' => t('To'), '#value' => $account->name);
+ $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 60, '#maxlength' => 50, '#required' => TRUE);
+ $form['message'] = array('#type' => 'textarea', '#title' => t('Message'), '#cols' => 60, '#rows' => 15, '#required' => TRUE);
+ $form['copy'] = array('#type' => 'checkbox', '#title' => ('Send me a copy.'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Send e-mail'));
$output = drupal_get_form('contact_user_mail', $form);
}
@@ -188,10 +188,10 @@ function contact_admin_edit($category = NULL) {
$edit['reply'] = $category->reply;
}
- $form['category'] = array(type => 'textfield', title => t('Category'), size => 60, maxlength => 255, default_value => $edit['category'], description => t("Example: 'website feedback' or 'product information'."), required => TRUE);
- $form['recipients'] = array(type => 'textarea', title => t('Recipients'), cols => 60, rows => 5, default_value => $edit['recipients'], description => t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."), required => TRUE);
- $form['reply'] = array(type => 'textarea', title => t('Auto-reply'), cols => 60, rows => 5, default_value => $edit['reply'], description => t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['category'], '#description' => t("Example: 'website feedback' or 'product information'."), '#required' => TRUE);
+ $form['recipients'] = array('#type' => 'textarea', '#title' => t('Recipients'), '#cols' => 60, '#rows' => 5, '#default_value' => $edit['recipients'], '#description' => t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."), '#required' => TRUE);
+ $form['reply'] = array('#type' => 'textarea', '#title' => t('Auto-reply'), '#cols' => 60, '#rows' => 5, '#default_value' => $edit['reply'], '#description' => t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
return drupal_get_form('contact_admin_edit', $form);
}
@@ -241,17 +241,17 @@ function contact_mail_page() {
}
if (count($categories) > 1) {
- $form[token] = $user->name . $user->mail;
- $form['contact_information'] = array(type => 'markup', value => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')));
- $form['name'] = array(type => 'textfield', title => t('Your name'), size => 60, maxlength => 255, default_value => $edit['name'], required => TRUE);
- $form['mail'] = array(type => 'textfield', title => t('Your e-mail address'), size => 60, maxlength => 255, default_value => $edit['mail'], required => TRUE);
- $form['subject'] = array(type => 'textfield', title => t('Subject'), size => 60, maxlength => 255, default_value => $edit['subject'], required => TRUE);
+ $form['#token'] = $user->name . $user->mail;
+ $form['contact_information'] = array('#type' => 'markup', '#value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['name'], '#required' => TRUE);
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('Your e-mail address'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['mail'], '#required' => TRUE);
+ $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['subject'], '#required' => TRUE);
if (count($categories) > 2) {
- $form['category'] = array(type => 'select', title => t('Category'), size => 60, maxlength => 255, default_value => $edit['category'], options => $categories, required => TRUE);
+ $form['category'] = array('#type' => 'select', '#title' => t('Category'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['category'], '#options' => $categories, '#required' => TRUE);
}
- $form['message'] = array(type => 'textarea', title => t('Message'), cols => 60, rows => 5, default_value => $edit['message'], required => TRUE);
- $form['copy'] = array(type => 'checkbox', title => t('Send me a copy.'), default_value => $edit['copy'], return_value => 1);
- $form['submit'] = array(type => 'submit', value => t('Send e-mail'));
+ $form['message'] = array('#type' => 'textarea', '#title' => t('Message'), '#cols' => 60, '#rows' => 5, '#default_value' => $edit['message'], '#required' => TRUE);
+ $form['copy'] = array('#type' => 'checkbox', '#title' => t('Send me a copy.'), '#default_value' => $edit['copy'], '#return_value' => 1);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Send e-mail'));
$output = drupal_get_form('contact_mail_page', $form);
}
else {
diff --git a/modules/contact/contact.module b/modules/contact/contact.module
index fa49ab317..91ee383ef 100644
--- a/modules/contact/contact.module
+++ b/modules/contact/contact.module
@@ -59,9 +59,9 @@ function contact_menu($may_cache) {
*/
function contact_settings() {
$form['contact_form_information'] = array(
- type => 'textarea', title => t('Additional information'), cols => 60, rows => 5,
- default_value => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')),
- description => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact')))
+ '#type' => 'textarea', '#title' => t('Additional information'), '#cols' => 60, '#rows' => 5,
+ '#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')),
+ '#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact')))
);
return $form;
}
@@ -73,8 +73,8 @@ function contact_settings() {
*/
function contact_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
- $form['contact'] = array(type => 'fieldset', title => t('Contact settings'), weight => 5, collapsible => TRUE, collapsed => FALSE);
- $form['contact']['contact'] = array(type => 'checkbox', title => t('Personal contact form'), return_value => 1, default_value => $edit['contact'], description => t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('%url' => url("user/$user->uid/contact"))));
+ $form['contact'] = array('#type' => 'fieldset', '#title' => t('Contact settings'), '#weight' => 5, '#collapsible' => TRUE, '#collapsed' => FALSE);
+ $form['contact']['contact'] = array('#type' => 'checkbox', '#title' => t('Personal contact form'), '#return_value' => 1, '#default_value' => $edit['contact'], '#description' => t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that your e-mail address is not made public and that privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('%url' => url("user/$user->uid/contact"))));
return $form;
//return array(array('title' => t('Contact settings'), 'data' => drupal_get_form('contact_user', $form), 'weight' => 2));
}
@@ -102,13 +102,13 @@ function contact_mail_user() {
else {
drupal_set_title($account->name);
- $form[token] = $user->name . $user->mail;
- $form['from'] = array(type => 'item', title => t('From'), value => $user->name .' &lt;'. $user->mail .'&gt;');
- $form['to'] = array(type => 'item', title => t('To'), value => $account->name);
- $form['subject'] = array(type => 'textfield', title => t('Subject'), size => 60, maxlength => 50, required => TRUE);
- $form['message'] = array(type => 'textarea', title => t('Message'), cols => 60, rows => 15, required => TRUE);
- $form['copy'] = array(type => 'checkbox', title => ('Send me a copy.'));
- $form['submit'] = array(type => 'submit', value => t('Send e-mail'));
+ $form['#token'] = $user->name . $user->mail;
+ $form['from'] = array('#type' => 'item', '#title' => t('From'), '#value' => $user->name .' &lt;'. $user->mail .'&gt;');
+ $form['to'] = array('#type' => 'item', '#title' => t('To'), '#value' => $account->name);
+ $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 60, '#maxlength' => 50, '#required' => TRUE);
+ $form['message'] = array('#type' => 'textarea', '#title' => t('Message'), '#cols' => 60, '#rows' => 15, '#required' => TRUE);
+ $form['copy'] = array('#type' => 'checkbox', '#title' => ('Send me a copy.'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Send e-mail'));
$output = drupal_get_form('contact_user_mail', $form);
}
@@ -188,10 +188,10 @@ function contact_admin_edit($category = NULL) {
$edit['reply'] = $category->reply;
}
- $form['category'] = array(type => 'textfield', title => t('Category'), size => 60, maxlength => 255, default_value => $edit['category'], description => t("Example: 'website feedback' or 'product information'."), required => TRUE);
- $form['recipients'] = array(type => 'textarea', title => t('Recipients'), cols => 60, rows => 5, default_value => $edit['recipients'], description => t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."), required => TRUE);
- $form['reply'] = array(type => 'textarea', title => t('Auto-reply'), cols => 60, rows => 5, default_value => $edit['reply'], description => t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['category'], '#description' => t("Example: 'website feedback' or 'product information'."), '#required' => TRUE);
+ $form['recipients'] = array('#type' => 'textarea', '#title' => t('Recipients'), '#cols' => 60, '#rows' => 5, '#default_value' => $edit['recipients'], '#description' => t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple repecients, separate each e-mail address with a comma."), '#required' => TRUE);
+ $form['reply'] = array('#type' => 'textarea', '#title' => t('Auto-reply'), '#cols' => 60, '#rows' => 5, '#default_value' => $edit['reply'], '#description' => t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
return drupal_get_form('contact_admin_edit', $form);
}
@@ -241,17 +241,17 @@ function contact_mail_page() {
}
if (count($categories) > 1) {
- $form[token] = $user->name . $user->mail;
- $form['contact_information'] = array(type => 'markup', value => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')));
- $form['name'] = array(type => 'textfield', title => t('Your name'), size => 60, maxlength => 255, default_value => $edit['name'], required => TRUE);
- $form['mail'] = array(type => 'textfield', title => t('Your e-mail address'), size => 60, maxlength => 255, default_value => $edit['mail'], required => TRUE);
- $form['subject'] = array(type => 'textfield', title => t('Subject'), size => 60, maxlength => 255, default_value => $edit['subject'], required => TRUE);
+ $form['#token'] = $user->name . $user->mail;
+ $form['contact_information'] = array('#type' => 'markup', '#value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['name'], '#required' => TRUE);
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('Your e-mail address'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['mail'], '#required' => TRUE);
+ $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['subject'], '#required' => TRUE);
if (count($categories) > 2) {
- $form['category'] = array(type => 'select', title => t('Category'), size => 60, maxlength => 255, default_value => $edit['category'], options => $categories, required => TRUE);
+ $form['category'] = array('#type' => 'select', '#title' => t('Category'), '#size' => 60, '#maxlength' => 255, '#default_value' => $edit['category'], '#options' => $categories, '#required' => TRUE);
}
- $form['message'] = array(type => 'textarea', title => t('Message'), cols => 60, rows => 5, default_value => $edit['message'], required => TRUE);
- $form['copy'] = array(type => 'checkbox', title => t('Send me a copy.'), default_value => $edit['copy'], return_value => 1);
- $form['submit'] = array(type => 'submit', value => t('Send e-mail'));
+ $form['message'] = array('#type' => 'textarea', '#title' => t('Message'), '#cols' => 60, '#rows' => 5, '#default_value' => $edit['message'], '#required' => TRUE);
+ $form['copy'] = array('#type' => 'checkbox', '#title' => t('Send me a copy.'), '#default_value' => $edit['copy'], '#return_value' => 1);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Send e-mail'));
$output = drupal_get_form('contact_mail_page', $form);
}
else {
diff --git a/modules/drupal.module b/modules/drupal.module
index c3bcaf052..9bc72f7f1 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -46,12 +46,12 @@ function drupal_settings() {
form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">administer &raquo; settings</a> page.' , array('%url' => url('admin/settings'))));
}
- $form['drupal_server'] = array(type => 'textfield', title => t('Drupal XML-RPC server'), default_value => variable_get('drupal_server', 'http://www.drupal.org/xmlrpc.php'), size => 60, maxlength => 128, description => t('The URL of your root Drupal XML-RPC server.'));
+ $form['drupal_server'] = array('#type' => 'textfield', '#title' => t('Drupal XML-RPC server'), '#default_value' => variable_get('drupal_server', 'http://www.drupal.org/xmlrpc.php'), '#size' => 60, '#maxlength' => 128, '#description' => t('The URL of your root Drupal XML-RPC server.'));
$form['drupal_directory'] = array(
- type => 'radios', title => t('Drupal directory'), default_value => variable_get('drupal_directory', 0),
- options => array(t('Disabled'), t('Enabled')),
- description => t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php", "%drupal-sites" => "http://www.drupal.org/drupal-sites/"))
+ '#type' => 'radios', '#title' => t('Drupal directory'), '#default_value' => variable_get('drupal_directory', 0),
+ '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php", "%drupal-sites" => "http://www.drupal.org/drupal-sites/"))
);
return $form;
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index c3bcaf052..9bc72f7f1 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -46,12 +46,12 @@ function drupal_settings() {
form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">administer &raquo; settings</a> page.' , array('%url' => url('admin/settings'))));
}
- $form['drupal_server'] = array(type => 'textfield', title => t('Drupal XML-RPC server'), default_value => variable_get('drupal_server', 'http://www.drupal.org/xmlrpc.php'), size => 60, maxlength => 128, description => t('The URL of your root Drupal XML-RPC server.'));
+ $form['drupal_server'] = array('#type' => 'textfield', '#title' => t('Drupal XML-RPC server'), '#default_value' => variable_get('drupal_server', 'http://www.drupal.org/xmlrpc.php'), '#size' => 60, '#maxlength' => 128, '#description' => t('The URL of your root Drupal XML-RPC server.'));
$form['drupal_directory'] = array(
- type => 'radios', title => t('Drupal directory'), default_value => variable_get('drupal_directory', 0),
- options => array(t('Disabled'), t('Enabled')),
- description => t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php", "%drupal-sites" => "http://www.drupal.org/drupal-sites/"))
+ '#type' => 'radios', '#title' => t('Drupal directory'), '#default_value' => variable_get('drupal_directory', 0),
+ '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php", "%drupal-sites" => "http://www.drupal.org/drupal-sites/"))
);
return $form;
diff --git a/modules/filter.module b/modules/filter.module
index 8d396bc59..1c17624f0 100644
--- a/modules/filter.module
+++ b/modules/filter.module
@@ -291,13 +291,13 @@ function filter_admin_overview() {
$row = array();
$default = ($id == variable_get('filter_default_format', 1));
$options[$id] = '';
- $form[$format->name]['id'] = array(type => 'markup', value => $id);
- $form[$format->name]['roles'] = array(type => 'markup', value => $roles ? implode(', ',$roles) : t('No roles may use this format'));
- $form[$format->name]['configure'] = array(type => 'markup', value => l(t('configure'), 'admin/filters/'. $id));
- $form[$format->name]['delete'] = array(type => 'markup', value => $default ? '' : l('delete', 'admin/filters/delete/'. $id));
+ $form[$format->name]['id'] = array('#type' => 'markup', '#value' => $id);
+ $form[$format->name]['roles'] = array('#type' => 'markup', '#value' => $roles ? implode(', ',$roles) : t('No roles may use this format'));
+ $form[$format->name]['configure'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/filters/'. $id));
+ $form[$format->name]['delete'] = array('#type' => 'markup', '#value' => $default ? '' : l('delete', 'admin/filters/delete/'. $id));
}
- $form['default'] = array(type => 'radios', options => $options, default_value => variable_get('filter_default_format', 1));
- $form['submit'] = array(type => 'submit', value => t('Set default format'));
+ $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Set default format'));
return drupal_get_form('filter_admin_overview', $form);
}
@@ -305,7 +305,7 @@ function theme_filter_admin_overview($form) {
foreach ($form as $name => $element) {
if (isset($element['roles']) && is_array($element['roles'])) {
$rows[] = array(
- form_render($form['default'][$element['id'][value]]),
+ form_render($form['default'][$element['id']['#value']]),
$name,
form_render($element['roles']),
form_render($element['configure']),
@@ -360,8 +360,8 @@ function filter_admin_delete() {
$format = arg(3);
$format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
- $form['format'] = array(type => 'hidden', value => $format->format);
- $form['name'] = array(type => 'hidden', value => $format->name);
+ $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
+ $form['name'] = array('#type' => 'hidden', '#value' => $format->name);
return confirm_form('filter_admin_delete', $form, t('Are you sure you want to delete the input format %format?', array('%format' => theme('placeholder', $format->name))), 'admin/filters', t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'), t('Delete'), t('Cancel'));
@@ -402,33 +402,33 @@ function filter_admin_format_form($format) {
$default = ($format->format == variable_get('filter_default_format', 1));
if ($default) {
$help = t('All roles for the default format must be enabled and cannot be changed.');
- $form['default_format'] = array(type => 'hidden', value => 1);
+ $form['default_format'] = array('#type' => 'hidden', '#value' => 1);
}
//Add the name of the object
- $form['name'] = array(type => 'fieldset', title => t('Name'));
- $form['name']['name'] = array(type => 'textfield', default_value => $format->name, size => 60, maxlength => 127, description => t('Give the name of this filter format'), required => TRUE);
+ $form['name'] = array('#type' => 'fieldset', '#title' => t('Name'));
+ $form['name']['name'] = array('#type' => 'textfield', '#default_value' => $format->name, '#size' => 60, '#maxlength' => 127, '#description' => t('Give the name of this filter format'), '#required' => TRUE);
//Add a row of checkboxes for form group
- $form['roles'] = array(type => 'fieldset', title => t('Roles'), description => $default ? $help : t('Choose which roles may use this filter format.'), tree => TRUE);
+ $form['roles'] = array('#type' => 'fieldset', '#title' => t('Roles'), '#description' => $default ? $help : t('Choose which roles may use this filter format.'), '#tree' => TRUE);
$form['roles']['hidden'] = array();
foreach (user_roles() as $rid => $name) {
$checked = strstr($format->roles, ",$rid,");
- $form['roles'][$rid] = array(type => 'checkbox', title => $name, default_value => ($default || $checked));
+ $form['roles'][$rid] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => ($default || $checked));
if ($default) {
- $form['roles'][$rid][attributes] = array('disabled' => 'disabled');
+ $form['roles'][$rid]['#attributes'] = array('disabled' => 'disabled');
}
}
// Table with filters
$all = filter_list_all();
$enabled = filter_list_format($format->format);
- $form['filters'] = array(type => 'fieldset', title => t('Filters'), description => t('Choose the filters that will be used in this filter format'));
+ $form['filters'] = array('#type' => 'fieldset', '#title' => t('Filters'), '#description' => t('Choose the filters that will be used in this filter format'));
foreach ($all as $id => $filter) {
- $form['filters'][$id] = array(type => 'checkbox', title => $filter->name, default_value => isset($enabled[$id]), description => module_invoke($filter->module, 'filter', 'description', $filter->delta));
+ $form['filters'][$id] = array('#type' => 'checkbox', '#title' => $filter->name, '#default_value' => isset($enabled[$id]), '#description' => module_invoke($filter->module, 'filter', 'description', $filter->delta));
}
- $form['submit'] = array(type => 'submit', value => t('Save configuration'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('filter_admin_format_form', $form);
}
@@ -475,7 +475,8 @@ function filter_admin_filters_save($format, $toggles) {
// We store the roles as a string for ease of use.
// we should always set all roles to true when saving a default role.
// We use leading and trailing comma's to allow easy substring matching.
- $roles = ','. implode(',', $edit['default_format'] ? user_roles() : array_keys($edit['roles'])) .',';
+ $roles = isset($edit['roles']) ? $edit['roles'] : array();
+ $roles = ','. implode(',', ($edit['default_format'] ? user_roles() : $roles)) .',';
db_query("UPDATE {filter_formats} SET cache = %d, name='%s', roles = '%s' WHERE format = %d", $cache, $name, $roles, $format);
@@ -503,10 +504,10 @@ function filter_admin_order() {
$filters = filter_list_format($format);
foreach ($filters as $id => $filter) {
- $form['name'][$id] = array(type => 'markup', value => $filter->name);
- $form['weight'][$id] = array(type => 'weight', default_value => $filter->weight);
+ $form['name'][$id] = array('#type' => 'markup', '#value' => $filter->name);
+ $form['weight'][$id] = array('#type' => 'weight', '#default_value' => $filter->weight);
}
- $form['submit'] = array(type => 'submit', value => t('Save configuration'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('filter_admin_order', $form);
}
@@ -751,37 +752,48 @@ function filter_form($value = FILTER_FORMAT_DEFAULT) {
$extra = l(t('More information about formatting options'), 'filter/tips');
- $form['format'] = array(type => 'fieldset', title => t('Input format'), collapsible => TRUE, collapsed => TRUE, weight => -4);
+ $form['format'] = array('#type' => 'fieldset', '#title' => t('Input format'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -4);
if (count($formats) > 1) {
// Multiple formats available: display radio buttons with tips.
foreach ($formats as $format) {
- $form['format'][$format->format] = array(type => 'filter_format', title => $format->name, default_value => $value, return_value => $format->format, parents => array('format'), description => theme('filter_tips', _filter_tips($format->format, false)));
+ $form['format'][$format->format] = array('#type' => 'filter_format', '#title' => $format->name, '#default_value' => $value, '#return_value' => $format->format, '#parents' => array('format'), '#description' => theme('filter_tips', _filter_tips($format->format, false)), '#valid' => 'filter_form');
}
return $form;
}
else {
// Only one format available: use a hidden form item and only show tips.
$format = array_shift($formats);
- $form['format'][$format->name] = array(type => 'value', value => $format->format);
+ $form['format'][$format->name] = array('#type' => 'value', '#value' => $format->format);
$tips = _filter_tips(variable_get('filter_default_format', 1), false);
- $form['format']['guidelines'] = array(type => 'markup', title => t('Formatting guidelines'), value => theme('filter_tips', $tips, false, $extra));
+ $form['format']['guidelines'] = array('#type' => 'markup', '#title' => t('Formatting guidelines'), '#value' => theme('filter_tips', $tips, false, $extra));
return $form;
}
}
function filter_elements() {
- $type['filter_format'] = array(input => TRUE);
+ $type['filter_format'] = array('#input' => TRUE);
return $type;
}
function theme_filter_format($element) {
$output .= '<div>';
- $output .= '<label class="option"><input type="radio" class="form-radio" name="' . $element[name] . '" value="'. $element[return_value] .'"'. (($element[default_value] == $element[return_value]) ? ' checked="checked"' : '') .' /> '. $element[title] .'</label>';
- $output .= $element[description];
+ $output .= '<label class="option"><input type="radio" class="form-radio" name="' . $element['#name'] . '" value="'. $element['#return_value'] .'"'. (($element['#default_value'] == $element['#return_value']) ? ' checked="checked"' : '') .' /> '. $element['#title'] .'</label>';
+ $output .= $element['#description'];
$output .= '</div>';
return $output;
}
+function filter_form_valid($element) {
+ static $validated;
+ if ($validated) {
+ return;
+ }
+ $validated = 1;
+ $formats = filter_formats();
+ if (!isset($formats[$element['#value']])) {
+ form_set_error($element['#parents'][0], t('The supplied input format is invalid.'));
+ }
+}
/**
* Returns true if the user is allowed to access this format.
@@ -948,12 +960,12 @@ function filter_filter($op, $delta = 0, $format = -1, $text = '') {
* Settings for the HTML filter.
*/
function _filter_html_settings($format) {
- $form['filter_html'] = array(type => 'fieldset', title => t('HTML filter'), collapsible => TRUE, collapsed => TRUE);
- $form['filter_html']["filter_html_$format"] = array(type => 'radios', title => t('Filter HTML tags'), default_value => variable_get("filter_html_$format", FILTER_HTML_STRIP), options => array(FILTER_HTML_STRIP => t('Strip tags'), FILTER_HTML_ESCAPE => t('Escape tags')), description => t('How to deal with HTML tags in user-contributed content. If set to "Strip tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'));
- $form['filter_html']["allowed_html_$format"] = array(type => 'textfield', title => t('Allowed HTML tags'), default_value => variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'), size => 64, maxlength => 255, description => t('If "Strip tags" is selected, optionally specify tags which should not be stripped. Javascript event attributes are always stripped.'));
- $form['filter_html']["filter_html_help_$format"] = array(type => 'checkbox', title => t('Display HTML help'), default_value => variable_get("filter_html_help_$format", 1), description => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'));
- $form['filter_html']["filter_style_$format"] = array(type => 'radios', title => t('HTML style attributes'), default_value => variable_get("filter_style_$format", FILTER_STYLE_STRIP), options => array(FILTER_STYLE_ALLOW => t('Allowed'), FILTER_STYLE_STRIP => t('Removed')), description => t('If "Strip tags" is selected, you can choose whether "STYLE" attributes are allowed or removed from input.'));
- $form['filter_html']["filter_html_nofollow_$format"] = array(type => 'checkbox', title => t('Spam link deterrent'), default_value => variable_get("filter_html_nofollow_$format", FALSE), description => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'));
+ $form['filter_html'] = array('#type' => 'fieldset', '#title' => t('HTML filter'), '#collapsible' => TRUE, '#collapsed' => TRUE);
+ $form['filter_html']["filter_html_$format"] = array('#type' => 'radios', '#title' => t('Filter HTML tags'), '#default_value' => variable_get("filter_html_$format", FILTER_HTML_STRIP), '#options' => array(FILTER_HTML_STRIP => t('Strip tags'), FILTER_HTML_ESCAPE => t('Escape tags')), '#description' => t('How to deal with HTML tags in user-contributed content. If set to "Strip tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'));
+ $form['filter_html']["allowed_html_$format"] = array('#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#default_value' => variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'), '#size' => 64, '#maxlength' => 255, '#description' => t('If "Strip tags" is selected, optionally specify tags which should not be stripped. Javascript event attributes are always stripped.'));
+ $form['filter_html']["filter_html_help_$format"] = array('#type' => 'checkbox', '#title' => t('Display HTML help'), '#default_value' => variable_get("filter_html_help_$format", 1), '#description' => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'));
+ $form['filter_html']["filter_style_$format"] = array('#type' => 'radios', '#title' => t('HTML style attributes'), '#default_value' => variable_get("filter_style_$format", FILTER_STYLE_STRIP), '#options' => array(FILTER_STYLE_ALLOW => t('Allowed'), FILTER_STYLE_STRIP => t('Removed')), '#description' => t('If "Strip tags" is selected, you can choose whether "STYLE" attributes are allowed or removed from input.'));
+ $form['filter_html']["filter_html_nofollow_$format"] = array('#type' => 'checkbox', '#title' => t('Spam link deterrent'), '#default_value' => variable_get("filter_html_nofollow_$format", FALSE), '#description' => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'));
return $form;
}
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 8d396bc59..1c17624f0 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -291,13 +291,13 @@ function filter_admin_overview() {
$row = array();
$default = ($id == variable_get('filter_default_format', 1));
$options[$id] = '';
- $form[$format->name]['id'] = array(type => 'markup', value => $id);
- $form[$format->name]['roles'] = array(type => 'markup', value => $roles ? implode(', ',$roles) : t('No roles may use this format'));
- $form[$format->name]['configure'] = array(type => 'markup', value => l(t('configure'), 'admin/filters/'. $id));
- $form[$format->name]['delete'] = array(type => 'markup', value => $default ? '' : l('delete', 'admin/filters/delete/'. $id));
+ $form[$format->name]['id'] = array('#type' => 'markup', '#value' => $id);
+ $form[$format->name]['roles'] = array('#type' => 'markup', '#value' => $roles ? implode(', ',$roles) : t('No roles may use this format'));
+ $form[$format->name]['configure'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/filters/'. $id));
+ $form[$format->name]['delete'] = array('#type' => 'markup', '#value' => $default ? '' : l('delete', 'admin/filters/delete/'. $id));
}
- $form['default'] = array(type => 'radios', options => $options, default_value => variable_get('filter_default_format', 1));
- $form['submit'] = array(type => 'submit', value => t('Set default format'));
+ $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Set default format'));
return drupal_get_form('filter_admin_overview', $form);
}
@@ -305,7 +305,7 @@ function theme_filter_admin_overview($form) {
foreach ($form as $name => $element) {
if (isset($element['roles']) && is_array($element['roles'])) {
$rows[] = array(
- form_render($form['default'][$element['id'][value]]),
+ form_render($form['default'][$element['id']['#value']]),
$name,
form_render($element['roles']),
form_render($element['configure']),
@@ -360,8 +360,8 @@ function filter_admin_delete() {
$format = arg(3);
$format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
- $form['format'] = array(type => 'hidden', value => $format->format);
- $form['name'] = array(type => 'hidden', value => $format->name);
+ $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
+ $form['name'] = array('#type' => 'hidden', '#value' => $format->name);
return confirm_form('filter_admin_delete', $form, t('Are you sure you want to delete the input format %format?', array('%format' => theme('placeholder', $format->name))), 'admin/filters', t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'), t('Delete'), t('Cancel'));
@@ -402,33 +402,33 @@ function filter_admin_format_form($format) {
$default = ($format->format == variable_get('filter_default_format', 1));
if ($default) {
$help = t('All roles for the default format must be enabled and cannot be changed.');
- $form['default_format'] = array(type => 'hidden', value => 1);
+ $form['default_format'] = array('#type' => 'hidden', '#value' => 1);
}
//Add the name of the object
- $form['name'] = array(type => 'fieldset', title => t('Name'));
- $form['name']['name'] = array(type => 'textfield', default_value => $format->name, size => 60, maxlength => 127, description => t('Give the name of this filter format'), required => TRUE);
+ $form['name'] = array('#type' => 'fieldset', '#title' => t('Name'));
+ $form['name']['name'] = array('#type' => 'textfield', '#default_value' => $format->name, '#size' => 60, '#maxlength' => 127, '#description' => t('Give the name of this filter format'), '#required' => TRUE);
//Add a row of checkboxes for form group
- $form['roles'] = array(type => 'fieldset', title => t('Roles'), description => $default ? $help : t('Choose which roles may use this filter format.'), tree => TRUE);
+ $form['roles'] = array('#type' => 'fieldset', '#title' => t('Roles'), '#description' => $default ? $help : t('Choose which roles may use this filter format.'), '#tree' => TRUE);
$form['roles']['hidden'] = array();
foreach (user_roles() as $rid => $name) {
$checked = strstr($format->roles, ",$rid,");
- $form['roles'][$rid] = array(type => 'checkbox', title => $name, default_value => ($default || $checked));
+ $form['roles'][$rid] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => ($default || $checked));
if ($default) {
- $form['roles'][$rid][attributes] = array('disabled' => 'disabled');
+ $form['roles'][$rid]['#attributes'] = array('disabled' => 'disabled');
}
}
// Table with filters
$all = filter_list_all();
$enabled = filter_list_format($format->format);
- $form['filters'] = array(type => 'fieldset', title => t('Filters'), description => t('Choose the filters that will be used in this filter format'));
+ $form['filters'] = array('#type' => 'fieldset', '#title' => t('Filters'), '#description' => t('Choose the filters that will be used in this filter format'));
foreach ($all as $id => $filter) {
- $form['filters'][$id] = array(type => 'checkbox', title => $filter->name, default_value => isset($enabled[$id]), description => module_invoke($filter->module, 'filter', 'description', $filter->delta));
+ $form['filters'][$id] = array('#type' => 'checkbox', '#title' => $filter->name, '#default_value' => isset($enabled[$id]), '#description' => module_invoke($filter->module, 'filter', 'description', $filter->delta));
}
- $form['submit'] = array(type => 'submit', value => t('Save configuration'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('filter_admin_format_form', $form);
}
@@ -475,7 +475,8 @@ function filter_admin_filters_save($format, $toggles) {
// We store the roles as a string for ease of use.
// we should always set all roles to true when saving a default role.
// We use leading and trailing comma's to allow easy substring matching.
- $roles = ','. implode(',', $edit['default_format'] ? user_roles() : array_keys($edit['roles'])) .',';
+ $roles = isset($edit['roles']) ? $edit['roles'] : array();
+ $roles = ','. implode(',', ($edit['default_format'] ? user_roles() : $roles)) .',';
db_query("UPDATE {filter_formats} SET cache = %d, name='%s', roles = '%s' WHERE format = %d", $cache, $name, $roles, $format);
@@ -503,10 +504,10 @@ function filter_admin_order() {
$filters = filter_list_format($format);
foreach ($filters as $id => $filter) {
- $form['name'][$id] = array(type => 'markup', value => $filter->name);
- $form['weight'][$id] = array(type => 'weight', default_value => $filter->weight);
+ $form['name'][$id] = array('#type' => 'markup', '#value' => $filter->name);
+ $form['weight'][$id] = array('#type' => 'weight', '#default_value' => $filter->weight);
}
- $form['submit'] = array(type => 'submit', value => t('Save configuration'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('filter_admin_order', $form);
}
@@ -751,37 +752,48 @@ function filter_form($value = FILTER_FORMAT_DEFAULT) {
$extra = l(t('More information about formatting options'), 'filter/tips');
- $form['format'] = array(type => 'fieldset', title => t('Input format'), collapsible => TRUE, collapsed => TRUE, weight => -4);
+ $form['format'] = array('#type' => 'fieldset', '#title' => t('Input format'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -4);
if (count($formats) > 1) {
// Multiple formats available: display radio buttons with tips.
foreach ($formats as $format) {
- $form['format'][$format->format] = array(type => 'filter_format', title => $format->name, default_value => $value, return_value => $format->format, parents => array('format'), description => theme('filter_tips', _filter_tips($format->format, false)));
+ $form['format'][$format->format] = array('#type' => 'filter_format', '#title' => $format->name, '#default_value' => $value, '#return_value' => $format->format, '#parents' => array('format'), '#description' => theme('filter_tips', _filter_tips($format->format, false)), '#valid' => 'filter_form');
}
return $form;
}
else {
// Only one format available: use a hidden form item and only show tips.
$format = array_shift($formats);
- $form['format'][$format->name] = array(type => 'value', value => $format->format);
+ $form['format'][$format->name] = array('#type' => 'value', '#value' => $format->format);
$tips = _filter_tips(variable_get('filter_default_format', 1), false);
- $form['format']['guidelines'] = array(type => 'markup', title => t('Formatting guidelines'), value => theme('filter_tips', $tips, false, $extra));
+ $form['format']['guidelines'] = array('#type' => 'markup', '#title' => t('Formatting guidelines'), '#value' => theme('filter_tips', $tips, false, $extra));
return $form;
}
}
function filter_elements() {
- $type['filter_format'] = array(input => TRUE);
+ $type['filter_format'] = array('#input' => TRUE);
return $type;
}
function theme_filter_format($element) {
$output .= '<div>';
- $output .= '<label class="option"><input type="radio" class="form-radio" name="' . $element[name] . '" value="'. $element[return_value] .'"'. (($element[default_value] == $element[return_value]) ? ' checked="checked"' : '') .' /> '. $element[title] .'</label>';
- $output .= $element[description];
+ $output .= '<label class="option"><input type="radio" class="form-radio" name="' . $element['#name'] . '" value="'. $element['#return_value'] .'"'. (($element['#default_value'] == $element['#return_value']) ? ' checked="checked"' : '') .' /> '. $element['#title'] .'</label>';
+ $output .= $element['#description'];
$output .= '</div>';
return $output;
}
+function filter_form_valid($element) {
+ static $validated;
+ if ($validated) {
+ return;
+ }
+ $validated = 1;
+ $formats = filter_formats();
+ if (!isset($formats[$element['#value']])) {
+ form_set_error($element['#parents'][0], t('The supplied input format is invalid.'));
+ }
+}
/**
* Returns true if the user is allowed to access this format.
@@ -948,12 +960,12 @@ function filter_filter($op, $delta = 0, $format = -1, $text = '') {
* Settings for the HTML filter.
*/
function _filter_html_settings($format) {
- $form['filter_html'] = array(type => 'fieldset', title => t('HTML filter'), collapsible => TRUE, collapsed => TRUE);
- $form['filter_html']["filter_html_$format"] = array(type => 'radios', title => t('Filter HTML tags'), default_value => variable_get("filter_html_$format", FILTER_HTML_STRIP), options => array(FILTER_HTML_STRIP => t('Strip tags'), FILTER_HTML_ESCAPE => t('Escape tags')), description => t('How to deal with HTML tags in user-contributed content. If set to "Strip tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'));
- $form['filter_html']["allowed_html_$format"] = array(type => 'textfield', title => t('Allowed HTML tags'), default_value => variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'), size => 64, maxlength => 255, description => t('If "Strip tags" is selected, optionally specify tags which should not be stripped. Javascript event attributes are always stripped.'));
- $form['filter_html']["filter_html_help_$format"] = array(type => 'checkbox', title => t('Display HTML help'), default_value => variable_get("filter_html_help_$format", 1), description => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'));
- $form['filter_html']["filter_style_$format"] = array(type => 'radios', title => t('HTML style attributes'), default_value => variable_get("filter_style_$format", FILTER_STYLE_STRIP), options => array(FILTER_STYLE_ALLOW => t('Allowed'), FILTER_STYLE_STRIP => t('Removed')), description => t('If "Strip tags" is selected, you can choose whether "STYLE" attributes are allowed or removed from input.'));
- $form['filter_html']["filter_html_nofollow_$format"] = array(type => 'checkbox', title => t('Spam link deterrent'), default_value => variable_get("filter_html_nofollow_$format", FALSE), description => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'));
+ $form['filter_html'] = array('#type' => 'fieldset', '#title' => t('HTML filter'), '#collapsible' => TRUE, '#collapsed' => TRUE);
+ $form['filter_html']["filter_html_$format"] = array('#type' => 'radios', '#title' => t('Filter HTML tags'), '#default_value' => variable_get("filter_html_$format", FILTER_HTML_STRIP), '#options' => array(FILTER_HTML_STRIP => t('Strip tags'), FILTER_HTML_ESCAPE => t('Escape tags')), '#description' => t('How to deal with HTML tags in user-contributed content. If set to "Strip tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'));
+ $form['filter_html']["allowed_html_$format"] = array('#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#default_value' => variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'), '#size' => 64, '#maxlength' => 255, '#description' => t('If "Strip tags" is selected, optionally specify tags which should not be stripped. Javascript event attributes are always stripped.'));
+ $form['filter_html']["filter_html_help_$format"] = array('#type' => 'checkbox', '#title' => t('Display HTML help'), '#default_value' => variable_get("filter_html_help_$format", 1), '#description' => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'));
+ $form['filter_html']["filter_style_$format"] = array('#type' => 'radios', '#title' => t('HTML style attributes'), '#default_value' => variable_get("filter_style_$format", FILTER_STYLE_STRIP), '#options' => array(FILTER_STYLE_ALLOW => t('Allowed'), FILTER_STYLE_STRIP => t('Removed')), '#description' => t('If "Strip tags" is selected, you can choose whether "STYLE" attributes are allowed or removed from input.'));
+ $form['filter_html']["filter_html_nofollow_$format"] = array('#type' => 'checkbox', '#title' => t('Spam link deterrent'), '#default_value' => variable_get("filter_html_nofollow_$format", FALSE), '#description' => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'));
return $form;
}
diff --git a/modules/forum.module b/modules/forum.module
index ed53943ed..07232f441 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -136,7 +136,7 @@ function forum_admin() {
/**
* Implementation of hook_taxonomy().
*/
-function forum_taxonomy($op, $type, $object) {
+function forum_taxonomy($op, $type, $object = NULL) {
if ($op == 'delete' && $type == 'term' && $object->vid == _forum_get_vid()) {
$results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $object->tid);
while ($node = db_fetch_object($results)) {
@@ -158,7 +158,7 @@ function forum_taxonomy($op, $type, $object) {
function _forum_confirm_delete($tid) {
$term = taxonomy_get_term($tid);
- $form['tid'] = array(type => 'hidden', value => $tid);
+ $form['tid'] = array('#type' => 'hidden', '#value' => $tid);
return confirm_form('forum_confirm_delete', $form, t('Are you sure you want to delete the forum %name?', array('%name' => theme('placeholder', $term->name))),
'admin/forums', t('Deleting a forum or container will delete all sub-forums as well. This action cannot be undone.'), t('Delete'), t('Cancel'));
@@ -170,17 +170,17 @@ function _forum_confirm_delete($tid) {
* @param $edit Associative array containing a container term to be added or edited.
*/
function forum_form_container($edit = array()) {
- $form['name'] = array(title => t('Container name'), type => 'textfield', default_value => $edit['name'], size => 60, maxlength => 64, description => t('The container name is used to identify related forums.'), required => TRUE);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => ('The container description can give users more information about the forums it contains.'));
- $form['parent'][tree] = TRUE;
+ $form['name'] = array('#title' => t('Container name'), '#type' => 'textfield', '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The container name is used to identify related forums.'), '#required' => TRUE);
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => ('The container description can give users more information about the forums it contains.'));
+ $form['parent']['#tree'] = TRUE;
$form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'container');
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('When listing containers, those with with light (small) weights get listed before containers with heavier (larger) weights. Containers with equal weights are sorted alphabetically.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('When listing containers, those with with light (small) weights get listed before containers with heavier (larger) weights. Containers with equal weights are sorted alphabetically.'));
- $form['vid'] = array(type => 'hidden', value => _forum_get_vid());
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => _forum_get_vid());
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['tid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['tid'] = array(type => 'hidden', value => $edit['tid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
}
return drupal_get_form('forum_form_container', $form);
@@ -192,17 +192,17 @@ function forum_form_container($edit = array()) {
* @param $edit Associative array containing a forum term to be added or edited.
*/
function forum_form_forum($edit = array()) {
- $form['name'] = array(type => 'textfield', title => t('Forum name'), default_value => $edit['name'], size => 60, maxlength => 64, description => t('The forum name is used to identify related discussions.'), required => TRUE);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => ('The forum description can give users more information about the discussion topics it contains.'));
- $form['parent'][tree] = TRUE;
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Forum name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The forum name is used to identify related discussions.'), '#required' => TRUE);
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => ('The forum description can give users more information about the discussion topics it contains.'));
+ $form['parent']['#tree'] = TRUE;
$form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'forum');
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('When listing forums, those with with light (small) weights get listed before containers with heavier (larger) weights. Forums with equal weights are sorted alphabetically.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('When listing forums, those with with light (small) weights get listed before containers with heavier (larger) weights. Forums with equal weights are sorted alphabetically.'));
- $form['vid'] = array(type => 'hidden', value => _forum_get_vid());
- $form['submit' ] = array(type => 'submit', value => t('Submit'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => _forum_get_vid());
+ $form['submit' ] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['tid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['tid'] = array(type => 'hidden', value => $edit['tid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
}
return drupal_get_form('forum_form_forum', $form);
@@ -250,7 +250,7 @@ function _forum_parent_select($tid, $title, $child_type) {
$description = t('You may place your forum inside a parent container or forum, or at the top (root) level of your forum.');
}
- return array(type => 'select', title => $title, default_value => $parent, options => $options, description => $description, required => TRUE);
+ return array('#type' => 'select', '#title' => $title, '#default_value' => $parent, '#options' => $options, '#description' => $description, '#required' => TRUE);
}
/**
@@ -299,7 +299,7 @@ function _forum_get_vid() {
// Check to see if a forum vocabulary exists
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'forum'));
if (!$vid) {
- $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum'));
+ $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum' => 1));
taxonomy_save_vocabulary($edit);
$vid = $edit['vid'];
}
@@ -315,13 +315,13 @@ function _forum_get_vid() {
function forum_admin_configure() {
$form = array();
- $form['forum_icon_path'] = array(type => 'textfield', title => t('Forum icon path'), default_value => variable_get('forum_icon_path', ''), size => 30, maxlength => 255, description => t('The path to the forum icons. Leave blank to disable icons. Don\'t add a trailing slash. Default icons are available in the "misc" directory. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16. '));
+ $form['forum_icon_path'] = array('#type' => 'textfield', '#title' => t('Forum icon path'), '#default_value' => variable_get('forum_icon_path', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('The path to the forum icons. Leave blank to disable icons. Don\'t add a trailing slash. Default icons are available in the "misc" directory. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16. '));
$number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 10000));
- $form['forum_hot_topic'] = array(type => 'select', title => t('Hot topic threshold'), default_value => variable_get('forum_hot_topic', 15), options => $number, description => t('The number of posts a topic must have to be considered hot.'));
+ $form['forum_hot_topic'] = array('#type' => 'select', '#title' => t('Hot topic threshold'), '#default_value' => variable_get('forum_hot_topic', 15), '#options' => $number, '#description' => t('The number of posts a topic must have to be considered hot.'));
$number = drupal_map_assoc(array(10, 25, 50, 75, 100));
- $form['forum_per_page'] = array(type => 'select', title => t('Topics per page'), default_value => variable_get('forum_per_page', 25), options => $number, description => t('The default number of topics displayed per page; links to browse older messages are automatically being displayed.'));
+ $form['forum_per_page'] = array('#type' => 'select', '#title' => t('Topics per page'), '#default_value' => variable_get('forum_per_page', 25), '#options' => $number, '#description' => t('The default number of topics displayed per page; links to browse older messages are automatically being displayed.'));
$forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4=> t('Posts - least active first'));
- $form['forum_order'] = array(type => 'radios', title => t('Default order'), default_value => variable_get('forum_order', '1'), options => $forder, description => t('The default display order for topics.'));
+ $form['forum_order'] = array('#type' => 'radios', '#title' => t('Default order'), '#default_value' => variable_get('forum_order', '1'), '#options' => $forder, '#description' => t('The default display order for topics.'));
return system_settings_form('forum_admin_configure', $form);
}
@@ -349,7 +349,7 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) {
return $blocks;
case 'configure':
- $form['forum_block_num_'. $delta] = array(type => 'select', title => t('Number of topics'), default_value => variable_get('forum_block_num_'. $delta, '5'), options => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
+ $form['forum_block_num_'. $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get('forum_block_num_'. $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
return $form;
case 'save':
@@ -555,7 +555,7 @@ function forum_update($node) {
* Implementation of hook_form().
*/
function forum_form(&$node) {
- $form['title'] = array(type => 'textfield', title => t('Subject'), default_value => $node->title, size => 60, maxlength => 128, required => TRUE);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Subject'), '#default_value' => $node->title, '#size' => 60, '#maxlength' => 128, '#required' => TRUE);
if (!$node->nid) {
// new topic
@@ -565,17 +565,13 @@ function forum_form(&$node) {
$node->taxonomy = array($node->tid);
}
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('forum', $node);
- }
-
if ($node->nid) {
// if editing, give option to leave shadows
$shadow = (count(taxonomy_node_get_terms($node->nid)) > 1);
- $form['shadow'] = array(type => 'checkbox', 'title' => t('Leave shadow copy'), default_value => $shadow, description => t('If you move this topic, you can leave a link in the old forum to the new forum.'));
+ $form['shadow'] = array('#type' => 'checkbox', 'title' => t('Leave shadow copy'), '#default_value' => $shadow, '#description' => t('If you move this topic, you can leave a link in the old forum to the new forum.'));
}
- $form['body'] = array(type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index ed53943ed..07232f441 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -136,7 +136,7 @@ function forum_admin() {
/**
* Implementation of hook_taxonomy().
*/
-function forum_taxonomy($op, $type, $object) {
+function forum_taxonomy($op, $type, $object = NULL) {
if ($op == 'delete' && $type == 'term' && $object->vid == _forum_get_vid()) {
$results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $object->tid);
while ($node = db_fetch_object($results)) {
@@ -158,7 +158,7 @@ function forum_taxonomy($op, $type, $object) {
function _forum_confirm_delete($tid) {
$term = taxonomy_get_term($tid);
- $form['tid'] = array(type => 'hidden', value => $tid);
+ $form['tid'] = array('#type' => 'hidden', '#value' => $tid);
return confirm_form('forum_confirm_delete', $form, t('Are you sure you want to delete the forum %name?', array('%name' => theme('placeholder', $term->name))),
'admin/forums', t('Deleting a forum or container will delete all sub-forums as well. This action cannot be undone.'), t('Delete'), t('Cancel'));
@@ -170,17 +170,17 @@ function _forum_confirm_delete($tid) {
* @param $edit Associative array containing a container term to be added or edited.
*/
function forum_form_container($edit = array()) {
- $form['name'] = array(title => t('Container name'), type => 'textfield', default_value => $edit['name'], size => 60, maxlength => 64, description => t('The container name is used to identify related forums.'), required => TRUE);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => ('The container description can give users more information about the forums it contains.'));
- $form['parent'][tree] = TRUE;
+ $form['name'] = array('#title' => t('Container name'), '#type' => 'textfield', '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The container name is used to identify related forums.'), '#required' => TRUE);
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => ('The container description can give users more information about the forums it contains.'));
+ $form['parent']['#tree'] = TRUE;
$form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'container');
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('When listing containers, those with with light (small) weights get listed before containers with heavier (larger) weights. Containers with equal weights are sorted alphabetically.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('When listing containers, those with with light (small) weights get listed before containers with heavier (larger) weights. Containers with equal weights are sorted alphabetically.'));
- $form['vid'] = array(type => 'hidden', value => _forum_get_vid());
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => _forum_get_vid());
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['tid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['tid'] = array(type => 'hidden', value => $edit['tid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
}
return drupal_get_form('forum_form_container', $form);
@@ -192,17 +192,17 @@ function forum_form_container($edit = array()) {
* @param $edit Associative array containing a forum term to be added or edited.
*/
function forum_form_forum($edit = array()) {
- $form['name'] = array(type => 'textfield', title => t('Forum name'), default_value => $edit['name'], size => 60, maxlength => 64, description => t('The forum name is used to identify related discussions.'), required => TRUE);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => ('The forum description can give users more information about the discussion topics it contains.'));
- $form['parent'][tree] = TRUE;
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Forum name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The forum name is used to identify related discussions.'), '#required' => TRUE);
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => ('The forum description can give users more information about the discussion topics it contains.'));
+ $form['parent']['#tree'] = TRUE;
$form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'forum');
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('When listing forums, those with with light (small) weights get listed before containers with heavier (larger) weights. Forums with equal weights are sorted alphabetically.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('When listing forums, those with with light (small) weights get listed before containers with heavier (larger) weights. Forums with equal weights are sorted alphabetically.'));
- $form['vid'] = array(type => 'hidden', value => _forum_get_vid());
- $form['submit' ] = array(type => 'submit', value => t('Submit'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => _forum_get_vid());
+ $form['submit' ] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['tid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['tid'] = array(type => 'hidden', value => $edit['tid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
}
return drupal_get_form('forum_form_forum', $form);
@@ -250,7 +250,7 @@ function _forum_parent_select($tid, $title, $child_type) {
$description = t('You may place your forum inside a parent container or forum, or at the top (root) level of your forum.');
}
- return array(type => 'select', title => $title, default_value => $parent, options => $options, description => $description, required => TRUE);
+ return array('#type' => 'select', '#title' => $title, '#default_value' => $parent, '#options' => $options, '#description' => $description, '#required' => TRUE);
}
/**
@@ -299,7 +299,7 @@ function _forum_get_vid() {
// Check to see if a forum vocabulary exists
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'forum'));
if (!$vid) {
- $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum'));
+ $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum' => 1));
taxonomy_save_vocabulary($edit);
$vid = $edit['vid'];
}
@@ -315,13 +315,13 @@ function _forum_get_vid() {
function forum_admin_configure() {
$form = array();
- $form['forum_icon_path'] = array(type => 'textfield', title => t('Forum icon path'), default_value => variable_get('forum_icon_path', ''), size => 30, maxlength => 255, description => t('The path to the forum icons. Leave blank to disable icons. Don\'t add a trailing slash. Default icons are available in the "misc" directory. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16. '));
+ $form['forum_icon_path'] = array('#type' => 'textfield', '#title' => t('Forum icon path'), '#default_value' => variable_get('forum_icon_path', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('The path to the forum icons. Leave blank to disable icons. Don\'t add a trailing slash. Default icons are available in the "misc" directory. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16. '));
$number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 10000));
- $form['forum_hot_topic'] = array(type => 'select', title => t('Hot topic threshold'), default_value => variable_get('forum_hot_topic', 15), options => $number, description => t('The number of posts a topic must have to be considered hot.'));
+ $form['forum_hot_topic'] = array('#type' => 'select', '#title' => t('Hot topic threshold'), '#default_value' => variable_get('forum_hot_topic', 15), '#options' => $number, '#description' => t('The number of posts a topic must have to be considered hot.'));
$number = drupal_map_assoc(array(10, 25, 50, 75, 100));
- $form['forum_per_page'] = array(type => 'select', title => t('Topics per page'), default_value => variable_get('forum_per_page', 25), options => $number, description => t('The default number of topics displayed per page; links to browse older messages are automatically being displayed.'));
+ $form['forum_per_page'] = array('#type' => 'select', '#title' => t('Topics per page'), '#default_value' => variable_get('forum_per_page', 25), '#options' => $number, '#description' => t('The default number of topics displayed per page; links to browse older messages are automatically being displayed.'));
$forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4=> t('Posts - least active first'));
- $form['forum_order'] = array(type => 'radios', title => t('Default order'), default_value => variable_get('forum_order', '1'), options => $forder, description => t('The default display order for topics.'));
+ $form['forum_order'] = array('#type' => 'radios', '#title' => t('Default order'), '#default_value' => variable_get('forum_order', '1'), '#options' => $forder, '#description' => t('The default display order for topics.'));
return system_settings_form('forum_admin_configure', $form);
}
@@ -349,7 +349,7 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) {
return $blocks;
case 'configure':
- $form['forum_block_num_'. $delta] = array(type => 'select', title => t('Number of topics'), default_value => variable_get('forum_block_num_'. $delta, '5'), options => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
+ $form['forum_block_num_'. $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get('forum_block_num_'. $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
return $form;
case 'save':
@@ -555,7 +555,7 @@ function forum_update($node) {
* Implementation of hook_form().
*/
function forum_form(&$node) {
- $form['title'] = array(type => 'textfield', title => t('Subject'), default_value => $node->title, size => 60, maxlength => 128, required => TRUE);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Subject'), '#default_value' => $node->title, '#size' => 60, '#maxlength' => 128, '#required' => TRUE);
if (!$node->nid) {
// new topic
@@ -565,17 +565,13 @@ function forum_form(&$node) {
$node->taxonomy = array($node->tid);
}
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('forum', $node);
- }
-
if ($node->nid) {
// if editing, give option to leave shadows
$shadow = (count(taxonomy_node_get_terms($node->nid)) > 1);
- $form['shadow'] = array(type => 'checkbox', 'title' => t('Leave shadow copy'), default_value => $shadow, description => t('If you move this topic, you can leave a link in the old forum to the new forum.'));
+ $form['shadow'] = array('#type' => 'checkbox', 'title' => t('Leave shadow copy'), '#default_value' => $shadow, '#description' => t('If you move this topic, you can leave a link in the old forum to the new forum.'));
}
- $form['body'] = array(type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
diff --git a/modules/locale.module b/modules/locale.module
index 1f9f6115a..c41be7a3c 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -108,7 +108,7 @@ function locale_user($type, $edit, &$user, $category = NULL) {
$user->language = key($languages['name']);
}
$languages['name'] = array_map('check_plain', $languages['name']);
- return array(array('title' => t('Interface language settings'), 'data' => $form['locale_user'] = array(type => 'radios', title => t('Language'), default_value => $user->language, options => $languages['name'], description => t('Selecting a different locale will change the interface language of the site.'))));
+ return array(array('title' => t('Interface language settings'), 'data' => $form['locale_user'] = array('#type' => 'radios', '#title' => t('Language'), '#default_value' => $user->language, '#options' => $languages['name'], '#description' => t('Selecting a different locale will change the interface language of the site.'))));
}
}
@@ -319,7 +319,7 @@ function locale_admin_manage_delete_screen() {
// For other locales, warn user that data loss is ahead
$languages = locale_supported_languages(FALSE, TRUE);
- $form['langcode'] = array(type => 'hidden', value => $langcode);
+ $form['langcode'] = array('#type' => 'hidden', '#value' => $langcode);
return confirm_form('locale_admin_manage_delete_screen', $form,
t('Are you sure you want to delete the language %name?', array('%name' => theme('placeholder', t($languages['name'][$langcode])))),
'admin/locale/language/overview',
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 1f9f6115a..c41be7a3c 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -108,7 +108,7 @@ function locale_user($type, $edit, &$user, $category = NULL) {
$user->language = key($languages['name']);
}
$languages['name'] = array_map('check_plain', $languages['name']);
- return array(array('title' => t('Interface language settings'), 'data' => $form['locale_user'] = array(type => 'radios', title => t('Language'), default_value => $user->language, options => $languages['name'], description => t('Selecting a different locale will change the interface language of the site.'))));
+ return array(array('title' => t('Interface language settings'), 'data' => $form['locale_user'] = array('#type' => 'radios', '#title' => t('Language'), '#default_value' => $user->language, '#options' => $languages['name'], '#description' => t('Selecting a different locale will change the interface language of the site.'))));
}
}
@@ -319,7 +319,7 @@ function locale_admin_manage_delete_screen() {
// For other locales, warn user that data loss is ahead
$languages = locale_supported_languages(FALSE, TRUE);
- $form['langcode'] = array(type => 'hidden', value => $langcode);
+ $form['langcode'] = array('#type' => 'hidden', '#value' => $langcode);
return confirm_form('locale_admin_manage_delete_screen', $form,
t('Are you sure you want to delete the language %name?', array('%name' => theme('placeholder', t($languages['name'][$langcode])))),
'admin/locale/language/overview',
diff --git a/modules/menu.module b/modules/menu.module
index 7667c0c19..53389377a 100644
--- a/modules/menu.module
+++ b/modules/menu.module
@@ -298,16 +298,16 @@ function menu_edit_item($mid = 0) {
function menu_edit_item_form($edit) {
$menu = menu_get_menu();
- $form['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 128, description => t('The name of the menu.'), required => TRUE);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 128, '#description' => t('The name of the menu.'), '#required' => TRUE);
if ($edit['pid'] == 0) {
// Display a limited set of fields for menus (not items).
- $form['path'] = array(type => 'hidden', value => '');
- $form['pid'] = array(type => 'hidden', value => 0);
- $form['weight'] = array(type => 'hidden', value => 0);
+ $form['path'] = array('#type' => 'hidden', '#value' => '');
+ $form['pid'] = array('#type' => 'hidden', '#value' => 0);
+ $form['weight'] = array('#type' => 'hidden', '#value' => 0);
}
else {
- $form['description'] = array(type => textfield, title => t('Description'), default_value => $edit['description'], size => 60, maxlength => 128, description => t('The description displayed when hovering over a menu item.'));
+ $form['description'] = array('#type' => textfield, '#title' => t('Description'), '#default_value' => $edit['description'], '#size' => 60, '#maxlength' => 128, '#description' => t('The description displayed when hovering over a menu item.'));
$path_description = t('The Drupal path this menu item links to.');
if (isset($edit['path']) && array_key_exists($edit['path'], $menu['path index']) && $menu['path index'][$edit['path']] != $edit['mid']) {
@@ -317,32 +317,32 @@ function menu_edit_item_form($edit) {
}
if ($edit['type'] & MENU_CREATED_BY_ADMIN) {
- $form['path'] = array(type => 'textfield', title => t('Path'), default_value => $edit['path'], size => 60, maxlength => 128, description => $path_description, required => TRUE);
+ $form['path'] = array('#type' => 'textfield', '#title' => t('Path'), '#default_value' => $edit['path'], '#size' => 60, '#maxlength' => 128, '#description' => $path_description, '#required' => TRUE);
}
else {
- $form['_path'] = array(type => 'item', title => t('Path'), title => l($edit['path'], $edit['path']));
- $form['path'] = array(type => 'hidden', value => $edit['path']);
+ $form['_path'] = array('#type' => 'item', '#title' => t('Path'), '#title' => l($edit['path'], $edit['path']));
+ $form['path'] = array('#type' => 'hidden', '#value' => $edit['path']);
}
$expanded = $edit['type'] & MENU_EXPANDED ? 1 : 0;
- $form['expanded'] = array(type => 'checkbox', title => t('Expanded'), default_value => $expanded, description => t('If selected and this menu item has children, the menu will always appear expanded.'));
+ $form['expanded'] = array('#type' => 'checkbox', '#title' => t('Expanded'), '#default_value' => $expanded, '#description' => t('If selected and this menu item has children, the menu will always appear expanded.'));
// Generate a list of possible parents (not including this item or descendants).
$options = menu_parent_options($edit['mid']);
- $form['pid'] = array(type => 'select', title => t('Parent item'), default_value => $edit['pid'], options => $options);
+ $form['pid'] = array('#type' => 'select', '#title' => t('Parent item'), '#default_value' => $edit['pid'], '#options' => $options);
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'));
}
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
- $form['mid'] = array(type => 'hidden', value => $edit['mid']);
+ $form['mid'] = array('#type' => 'hidden', '#value' => $edit['mid']);
// Always enable menu items (but not menus) when editing them.
if (!($edit['type'] & MENU_IS_ROOT)) {
$edit['type'] |= MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB;
}
- $form['type'] = array(type => 'hidden', value => $edit['type']);
+ $form['type'] = array('#type' => 'hidden', '#value' => $edit['type']);
return drupal_get_form('menu_edit_item_form', $form);
}
@@ -543,22 +543,22 @@ function menu_node_form($edit = array()) {
}
}
- $form['menu'] = array(type => 'fieldset', title => t('Menu item settings'), collapsible => TRUE, collapsed => TRUE, tree => TRUE);
+ $form['menu'] = array('#type' => 'fieldset', '#title' => t('Menu item settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#tree' => TRUE);
- $form['menu']['title'] = array(type => 'textfield', title => t('Title'), default_value => $item['title'], size => 60, maxlength => 128, description => t('The name to display for this link.'));
+ $form['menu']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $item['title'], '#size' => 60, '#maxlength' => 128, '#description' => t('The name to display for this link.'));
// Generate a list of possible parents (not including this item or descendants).
$options = menu_parent_options($edit['mid']);
- $form['menu']['pid'] = array(type => select, title => t('Parent item'), default_value => $item['pid'], options => $options);
- $form['menu']['description'] = array(type => 'hidden', value => $item['description']);
- $form['menu']['path'] = array(type => 'hidden', value => $item['path']);
- $form['menu']['weight'] = array(type => 'hidden', value => $item['weight'] ? $item['weight'] : 0);
+ $form['menu']['pid'] = array('#type' => select, '#title' => t('Parent item'), '#default_value' => $item['pid'], '#options' => $options);
+ $form['menu']['description'] = array('#type' => 'hidden', '#value' => $item['description']);
+ $form['menu']['path'] = array('#type' => 'hidden', '#value' => $item['path']);
+ $form['menu']['weight'] = array('#type' => 'hidden', '#value' => $item['weight'] ? $item['weight'] : 0);
- $form['menu']['mid'] = array(type => 'hidden', value => $item['mid'] ? $item['mid'] : 0);
- $form['menu']['type'] = array(type => 'hidden', value => $item['type'] ? $item['type'] : MENU_CUSTOM_ITEM);
+ $form['menu']['mid'] = array('#type' => 'hidden', '#value' => $item['mid'] ? $item['mid'] : 0);
+ $form['menu']['type'] = array('#type' => 'hidden', '#value' => $item['type'] ? $item['type'] : MENU_CUSTOM_ITEM);
if ($item['mid'] > 0) {
- $form['menu']['delete'] = array(type => 'checkbox', title => t('Check to delete this menu item.'), default_value => $item['delete']);
+ $form['menu']['delete'] = array('#type' => 'checkbox', '#title' => t('Check to delete this menu item.'), '#default_value' => $item['delete']);
}
return $form;
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 7667c0c19..53389377a 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -298,16 +298,16 @@ function menu_edit_item($mid = 0) {
function menu_edit_item_form($edit) {
$menu = menu_get_menu();
- $form['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 128, description => t('The name of the menu.'), required => TRUE);
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 128, '#description' => t('The name of the menu.'), '#required' => TRUE);
if ($edit['pid'] == 0) {
// Display a limited set of fields for menus (not items).
- $form['path'] = array(type => 'hidden', value => '');
- $form['pid'] = array(type => 'hidden', value => 0);
- $form['weight'] = array(type => 'hidden', value => 0);
+ $form['path'] = array('#type' => 'hidden', '#value' => '');
+ $form['pid'] = array('#type' => 'hidden', '#value' => 0);
+ $form['weight'] = array('#type' => 'hidden', '#value' => 0);
}
else {
- $form['description'] = array(type => textfield, title => t('Description'), default_value => $edit['description'], size => 60, maxlength => 128, description => t('The description displayed when hovering over a menu item.'));
+ $form['description'] = array('#type' => textfield, '#title' => t('Description'), '#default_value' => $edit['description'], '#size' => 60, '#maxlength' => 128, '#description' => t('The description displayed when hovering over a menu item.'));
$path_description = t('The Drupal path this menu item links to.');
if (isset($edit['path']) && array_key_exists($edit['path'], $menu['path index']) && $menu['path index'][$edit['path']] != $edit['mid']) {
@@ -317,32 +317,32 @@ function menu_edit_item_form($edit) {
}
if ($edit['type'] & MENU_CREATED_BY_ADMIN) {
- $form['path'] = array(type => 'textfield', title => t('Path'), default_value => $edit['path'], size => 60, maxlength => 128, description => $path_description, required => TRUE);
+ $form['path'] = array('#type' => 'textfield', '#title' => t('Path'), '#default_value' => $edit['path'], '#size' => 60, '#maxlength' => 128, '#description' => $path_description, '#required' => TRUE);
}
else {
- $form['_path'] = array(type => 'item', title => t('Path'), title => l($edit['path'], $edit['path']));
- $form['path'] = array(type => 'hidden', value => $edit['path']);
+ $form['_path'] = array('#type' => 'item', '#title' => t('Path'), '#title' => l($edit['path'], $edit['path']));
+ $form['path'] = array('#type' => 'hidden', '#value' => $edit['path']);
}
$expanded = $edit['type'] & MENU_EXPANDED ? 1 : 0;
- $form['expanded'] = array(type => 'checkbox', title => t('Expanded'), default_value => $expanded, description => t('If selected and this menu item has children, the menu will always appear expanded.'));
+ $form['expanded'] = array('#type' => 'checkbox', '#title' => t('Expanded'), '#default_value' => $expanded, '#description' => t('If selected and this menu item has children, the menu will always appear expanded.'));
// Generate a list of possible parents (not including this item or descendants).
$options = menu_parent_options($edit['mid']);
- $form['pid'] = array(type => 'select', title => t('Parent item'), default_value => $edit['pid'], options => $options);
+ $form['pid'] = array('#type' => 'select', '#title' => t('Parent item'), '#default_value' => $edit['pid'], '#options' => $options);
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'));
}
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
- $form['mid'] = array(type => 'hidden', value => $edit['mid']);
+ $form['mid'] = array('#type' => 'hidden', '#value' => $edit['mid']);
// Always enable menu items (but not menus) when editing them.
if (!($edit['type'] & MENU_IS_ROOT)) {
$edit['type'] |= MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB;
}
- $form['type'] = array(type => 'hidden', value => $edit['type']);
+ $form['type'] = array('#type' => 'hidden', '#value' => $edit['type']);
return drupal_get_form('menu_edit_item_form', $form);
}
@@ -543,22 +543,22 @@ function menu_node_form($edit = array()) {
}
}
- $form['menu'] = array(type => 'fieldset', title => t('Menu item settings'), collapsible => TRUE, collapsed => TRUE, tree => TRUE);
+ $form['menu'] = array('#type' => 'fieldset', '#title' => t('Menu item settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#tree' => TRUE);
- $form['menu']['title'] = array(type => 'textfield', title => t('Title'), default_value => $item['title'], size => 60, maxlength => 128, description => t('The name to display for this link.'));
+ $form['menu']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $item['title'], '#size' => 60, '#maxlength' => 128, '#description' => t('The name to display for this link.'));
// Generate a list of possible parents (not including this item or descendants).
$options = menu_parent_options($edit['mid']);
- $form['menu']['pid'] = array(type => select, title => t('Parent item'), default_value => $item['pid'], options => $options);
- $form['menu']['description'] = array(type => 'hidden', value => $item['description']);
- $form['menu']['path'] = array(type => 'hidden', value => $item['path']);
- $form['menu']['weight'] = array(type => 'hidden', value => $item['weight'] ? $item['weight'] : 0);
+ $form['menu']['pid'] = array('#type' => select, '#title' => t('Parent item'), '#default_value' => $item['pid'], '#options' => $options);
+ $form['menu']['description'] = array('#type' => 'hidden', '#value' => $item['description']);
+ $form['menu']['path'] = array('#type' => 'hidden', '#value' => $item['path']);
+ $form['menu']['weight'] = array('#type' => 'hidden', '#value' => $item['weight'] ? $item['weight'] : 0);
- $form['menu']['mid'] = array(type => 'hidden', value => $item['mid'] ? $item['mid'] : 0);
- $form['menu']['type'] = array(type => 'hidden', value => $item['type'] ? $item['type'] : MENU_CUSTOM_ITEM);
+ $form['menu']['mid'] = array('#type' => 'hidden', '#value' => $item['mid'] ? $item['mid'] : 0);
+ $form['menu']['type'] = array('#type' => 'hidden', '#value' => $item['type'] ? $item['type'] : MENU_CUSTOM_ITEM);
if ($item['mid'] > 0) {
- $form['menu']['delete'] = array(type => 'checkbox', title => t('Check to delete this menu item.'), default_value => $item['delete']);
+ $form['menu']['delete'] = array('#type' => 'checkbox', '#title' => t('Check to delete this menu item.'), '#default_value' => $item['delete']);
}
return $form;
diff --git a/modules/node.module b/modules/node.module
index c684e4362..611389ea1 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -265,7 +265,7 @@ function node_get_name($node) {
* @param $node
* Either a node object, a node array, or a string containing the node type.
* @return
- * An array consisting (type => name) pairs.
+ * An array consisting ('#type' => name) pairs.
*/
function node_get_types() {
return _node_names('list');
@@ -641,22 +641,22 @@ function node_search($op = 'search', $keys = null) {
function node_configure() {
$form['default_nodes_main'] = array(
- type => 'select', title => t('Number of posts on main page'), default_value => variable_get('default_nodes_main', 10),
- options => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
- description => t('The default maximum number of posts to display per page on overview pages such as the main page.')
+ '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get('default_nodes_main', 10),
+ '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
+ '#description' => t('The default maximum number of posts to display per page on overview pages such as the main page.')
);
$form['teaser_length'] = array(
- type => 'select', title => t('Length of trimmed posts'), default_value => variable_get('teaser_length', 600),
- options => array(0 => t('Unlimited'), 200 => t('200 characters'), 400 => t('400 characters'), 600 => t('600 characters'),
+ '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get('teaser_length', 600),
+ '#options' => array(0 => t('Unlimited'), 200 => t('200 characters'), 400 => t('400 characters'), 600 => t('600 characters'),
800 => t('800 characters'), 1000 => t('1000 characters'), 1200 => t('1200 characters'), 1400 => t('1400 characters'),
1600 => t('1600 characters'), 1800 => t('1800 characters'), 2000 => t('2000 characters')),
- description => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.")
+ '#description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.")
);
$form['node_preview'] = array(
- type => 'radios', title => t('Preview post'), default_value => variable_get('node_preview', 0),
- options => array(t('Optional'), t('Required')), description => t('Must users preview posts before submitting?')
+ '#type' => 'radios', '#title' => t('Preview post'), '#default_value' => variable_get('node_preview', 0),
+ '#options' => array(t('Optional'), t('Required')), '#description' => t('Must users preview posts before submitting?')
);
return system_settings_form('node_configure', $form);
@@ -847,23 +847,23 @@ function node_filter_form() {
$filters = node_filters();
$i = 0;
- $form['filters'] = array(type => 'fieldset', title => t('Show only items where'), theme => 'node_filters');
+ $form['filters'] = array('#type' => 'fieldset', '#title' => t('Show only items where'), '#theme' => 'node_filters');
foreach ($session as $filter) {
list($type, $value) = $filter;
$string = ($i++ ? '<em>and</em> where <strong>%a</strong> is <strong>%b</strong>' : '<strong>%a</strong> is <strong>%b</strong>');
- $form['filters']['current'][] = array(value => t($string, array('%a' => $filters[$type]['title'] , '%b' => $filters[$type]['options'][$value])));
+ $form['filters']['current'][] = array('#value' => t($string, array('%a' => $filters[$type]['title'] , '%b' => $filters[$type]['options'][$value])));
}
foreach ($filters as $key => $filter) {
$names[$key] = $filter['title'];
- $form['filters']['status'][$key] = array(type => 'select', options => $filter['options']);
+ $form['filters']['status'][$key] = array('#type' => 'select', '#options' => $filter['options']);
}
- $form['filters']['filter'] = array(type => 'radios', options => $names, default_value => 'status');
- $form['filters']['buttons']['submit'] = array(type => 'submit', value => (count($session) ? t('Refine') : t('Filter')));
+ $form['filters']['filter'] = array('#type' => 'radios', '#options' => $names, '#default_value' => 'status');
+ $form['filters']['buttons']['submit'] = array('#type' => 'submit', '#value' => (count($session) ? t('Refine') : t('Filter')));
if (count($session)) {
- $form['filters']['buttons']['undo'] = array(type => 'submit', value => t('Undo'));
- $form['filters']['buttons']['reset'] = array(type => 'submit', value => t('Reset'));
+ $form['filters']['buttons']['undo'] = array('#type' => 'submit', '#value' => t('Undo'));
+ $form['filters']['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
}
return drupal_get_form('node_filter_form', $form);
@@ -968,30 +968,30 @@ function node_admin_nodes() {
$result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);
$form['options'] = array(
- type => 'fieldset', title => t('Update options'),
- prefix => "<div class=\"container-inline\">" , suffix => "</div>"
+ '#type' => 'fieldset', '#title' => t('Update options'),
+ '#prefix' => "<div class=\"container-inline\">" , '#suffix' => "</div>"
);
$options = array();
foreach (node_operations() as $key => $value) {
$options[$key] = $value[0];
}
- $form['options']['operation'] = array(type => 'select', options => $options, default_value => 'approve');
- $form['options']['submit'] = array(type => 'submit', value => t('Update'));
+ $form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'approve');
+ $form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update'));
$destination = drupal_get_destination();
while ($node = db_fetch_object($result)) {
$nodes[$node->nid] = '';
- $form['title'][$node->nid] = array(value => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)));
- $form['name'][$node->nid] = array(value => node_get_name($node));
- $form['username'][$node->nid] = array(value => theme('username', $node));
- $form['status'][$node->nid] = array(value => ($node->status ? t('published') : t('not published')));
- $form['operations'][$node->nid] = array(value => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
+ $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)));
+ $form['name'][$node->nid] = array('#value' => node_get_name($node));
+ $form['username'][$node->nid] = array('#value' => theme('username', $node));
+ $form['status'][$node->nid] = array('#value' => ($node->status ? t('published') : t('not published')));
+ $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
}
- $form['nodes'] = array(type => 'checkboxes', options => $nodes);
+ $form['nodes'] = array('#type' => 'checkboxes', '#options' => $nodes);
$form['pager'] = array('value' => theme('pager', NULL, 50, 0));
- $form[method] = 'post';
- $form[action] = url('admin/node/action');
+ $form['#method'] = 'post';
+ $form['#action'] = url('admin/node/action');
// Call the form first, to allow for the form_values array to be populated.
$output .= drupal_get_form('node_admin_nodes', $form);
@@ -1028,7 +1028,7 @@ function theme_node_admin_nodes($form) {
}
$output .= theme('table', $header, $rows);
- if ($form['pager'][value]) {
+ if ($form['pager']['#value']) {
$output .= form_render($form['pager']);
}
@@ -1037,14 +1037,14 @@ function theme_node_admin_nodes($form) {
function node_multiple_delete_form() {
global $form_values;
- $form['nodes'] = array(prefix => '<ul>', suffix => '</ul>');
+ $form['nodes'] = array('#prefix' => '<ul>', '#suffix' => '</ul>');
foreach ($form_values['nodes'] as $nid => $value) {
if ($value) {
$title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
- $form['nodes'][$nid] = array(type => 'hidden', value => $nid, tree => TRUE, prefix => '<li>', suffix => check_plain($title) .'</li>');
+ $form['nodes'][$nid] = array('#type' => 'hidden', '#value' => $nid, '#tree' => TRUE, '#prefix' => '<li>', '#suffix' => check_plain($title) .'</li>');
}
}
- $form['operation'] = array(type => 'hidden', value => 'delete');
+ $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
return confirm_form('node_multiple_delete_form', $form,
t('Are you sure you want to delete these items?'),
@@ -1071,16 +1071,16 @@ function node_types_configure($type = NULL) {
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
$node = new stdClass();
$node->type = $type;
- $form['submission'] = array(type => 'fieldset', title =>t('Submission form') );
+ $form['submission'] = array('#type' => 'fieldset', '#title' =>t('Submission form') );
$form['submission'][$type . '_help'] = array(
- type => 'textarea', title => t('Explanation or submission guidelines'), default_value => variable_get($type .'_help', ''), cols => 60, rows => 5,
- description => t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_get_name($type)))
+ '#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), '#default_value' => variable_get($type .'_help', ''), '#cols' => 60, '#rows' => 5,
+ '#description' => t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_get_name($type)))
);
$form['submission']['minimum_'. $type .'_size'] = array(
- type => 'select', title => t('Minimum number of words'), default_value => variable_get('minimum_'. $type .'_size', 0), options => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)),
- description => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type)))
+ '#type' => 'select', '#title' => t('Minimum number of words'), '#default_value' => variable_get('minimum_'. $type .'_size', 0), '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)),
+ '#description' => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type)))
);
- $form['workflow'] = array(type => 'fieldset', title =>t('Workflow'));
+ $form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'));
$form['workflow'] = array_merge($form['workflow'], node_invoke_nodeapi($node, 'settings'));
return system_settings_form($type . '_node_settings', $form);
@@ -1393,11 +1393,6 @@ function node_validate($node) {
node_invoke($node, 'validate');
node_invoke_nodeapi($node, 'validate');
- // Check input format access
- if (array_key_exists('format', $node) && !filter_access($node->format)) {
- form_set_error('format', t('The supplied input format is invalid.'));
- }
-
$node->validated = TRUE;
return $node;
@@ -1427,21 +1422,21 @@ function node_form($node) {
}
// Set the id of the top-level form tag
- $form[attributes]['id'] = 'node-form';
+ $form['#attributes']['id'] = 'node-form';
/**
* Basic node information.
* These elements are just values so they are not even sent to the client.
*/
- $form['nid'] = array(type => 'value', value => $node->nid);
- $form['vid'] = array(type => 'value', value => $node->vid);
- $form['uid'] = array(type => 'value', value => $node->uid);
- $form['created'] = array(type => 'value', value => $node->created);
- $form['changed'] = array(type => 'value', value => $node->changed);
- $form['type'] = array(type => 'value', value => $node->type);
+ $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
+ $form['vid'] = array('#type' => 'value', '#value' => $node->vid);
+ $form['uid'] = array('#type' => 'value', '#value' => $node->uid);
+ $form['created'] = array('#type' => 'value', '#value' => $node->created);
+ $form['changed'] = array('#type' => 'value', '#value' => $node->changed);
+ $form['type'] = array('#type' => 'value', '#value' => $node->type);
if ($op == t('Preview')) {
- $form['node_preview'] = array(value => node_preview(array2object($_POST['edit'])), weight => -100);
+ $form['node_preview'] = array('#value' => node_preview(array2object($_POST['edit'])), '#weight' => -100);
}
// Get the node-specific bits.
@@ -1457,37 +1452,39 @@ function node_form($node) {
* Node author information
*/
- $form['author'] = array(type => 'fieldset', title => t('Authoring information'), collapsible => TRUE, collapsed => TRUE, weight => -18);
- $form['author']['name'] = array(type => 'textfield', title => t('Authored by'), maxlength => 60, autocomplete_path => 'user/autocomplete', default_value => $node->name, weight => -1);
- $form['author']['date'] = array(type => 'textfield', title =>t('Authored on'), maxlength => 25, required => TRUE, default_value => $node->date);
+ if (user_access('administer nodes')) {
+ $form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -18);
+ $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name, '#weight' => -1);
+ $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#required' => TRUE, '#default_value' => $node->date);
- $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
+ $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
- /**
- * Node options
- */
- $form['options'] = array(type => 'fieldset', title => t('Publishing options'), collapsible => TRUE, collapsed => TRUE, weight => -18);
- $form['options']['status'] = array(type => 'checkbox', title => t('Published'), default_value => in_array('status', $node_options));
- $form['options']['moderate'] = array(type => 'checkbox', title => t('In moderation queue'), default_value => in_array('moderate', $node_options));
- $form['options']['promote'] = array(type => 'checkbox', title => t('Promoted to front page'), default_value => in_array('promote', $node_options));
- $form['options']['sticky'] = array(type => 'checkbox', title =>t('Sticky at top of lists'), default_value => in_array('sticky', $node_options));
- $form['options']['revision'] = array(type => 'checkbox', title =>t('Create new revision'), default_value => in_array('revision', $node_options));
+ /**
+ * Node options
+ */
+ $form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -18);
+ $form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => in_array('status', $node_options));
+ $form['options']['moderate'] = array('#type' => 'checkbox', '#title' => t('In moderation queue'), '#default_value' => in_array('moderate', $node_options));
+ $form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => in_array('promote', $node_options));
+ $form['options']['sticky'] = array('#type' => 'checkbox', '#title' =>t('Sticky at top of lists'), '#default_value' => in_array('sticky', $node_options));
+ $form['options']['revision'] = array('#type' => 'checkbox', '#title' =>t('Create new revision'), '#default_value' => in_array('revision', $node_options));
+ }
$nodeapi = node_invoke_nodeapi($node, 'form');
if (is_array($nodeapi)) {
foreach ($nodeapi as $key => $element) {
- $nodeapi[$key][weight] = isset($nodeapi[$key][weight]) ? $nodeapi[$key][weight] : -18;
+ $nodeapi[$key]['#weight'] = isset($nodeapi[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
}
// Append extra node form elements.
$form = array_merge($form, $nodeapi);
}
- $form['title'][weight] = isset($form['title'][weight]) ? $form['title'][weight] : -17;
- $form['body'][weight] = isset($form['body'][weight]) ? $form['body'][weight] : -5;
+ $form['title']['#weight'] = isset($form['title']['#weight']) ? $form['title']['#weight'] : -17;
+ $form['body']['#weight'] = isset($form['body']['#weight']) ? $form['body']['#weight'] : -5;
// Add the buttons.
- $form['preview'] = array(type => 'button', value => t('Preview'), weight => 19);
+ $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 19);
if ($node->type) {
if (!form_get_errors()) {
@@ -1496,9 +1493,9 @@ function node_form($node) {
}
}
}
- $form['submit'] = array(type => 'submit', value => t('Submit'), weight => 20);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
if ($node->nid && node_access('delete', $node)) {
- $form['delete'] = array(type => 'button', value => t('Delete'), weight => 21);
+ $form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 21);
}
return drupal_get_form($node->type . '_node_form', $form, 'node_form');
}
@@ -1687,7 +1684,7 @@ function node_delete($edit) {
$node = node_load($edit['nid']);
if (node_access('delete', $node)) {
- $form['nid'] = array(type => 'hidden', value => $node->nid);
+ $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
$output = confirm_form('node_delete_confirm', $form,
t('Are you sure you want to delete %title?', array('%title' => theme('placeholder', $node->title))),
$_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid, t('This action cannot be undone.'),
@@ -1908,10 +1905,10 @@ function node_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
$form['node_options_'. $node->type] = array(
- type => 'checkboxes', title => t('Default options'), default_value => variable_get('node_options_'. $node->type, array('status', 'promote')),
- options => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'),
+ '#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => variable_get('node_options_'. $node->type, array('status', 'promote')),
+ '#options' => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'),
'sticky' => t('Sticky at top of lists'), 'revision' => t('Create new revision')),
- description => t('Users with the <em>administer nodes</em> permission will be able to override these options.')
+ '#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.')
);
return $form;
}
diff --git a/modules/node/node.module b/modules/node/node.module
index c684e4362..611389ea1 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -265,7 +265,7 @@ function node_get_name($node) {
* @param $node
* Either a node object, a node array, or a string containing the node type.
* @return
- * An array consisting (type => name) pairs.
+ * An array consisting ('#type' => name) pairs.
*/
function node_get_types() {
return _node_names('list');
@@ -641,22 +641,22 @@ function node_search($op = 'search', $keys = null) {
function node_configure() {
$form['default_nodes_main'] = array(
- type => 'select', title => t('Number of posts on main page'), default_value => variable_get('default_nodes_main', 10),
- options => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
- description => t('The default maximum number of posts to display per page on overview pages such as the main page.')
+ '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get('default_nodes_main', 10),
+ '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
+ '#description' => t('The default maximum number of posts to display per page on overview pages such as the main page.')
);
$form['teaser_length'] = array(
- type => 'select', title => t('Length of trimmed posts'), default_value => variable_get('teaser_length', 600),
- options => array(0 => t('Unlimited'), 200 => t('200 characters'), 400 => t('400 characters'), 600 => t('600 characters'),
+ '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get('teaser_length', 600),
+ '#options' => array(0 => t('Unlimited'), 200 => t('200 characters'), 400 => t('400 characters'), 600 => t('600 characters'),
800 => t('800 characters'), 1000 => t('1000 characters'), 1200 => t('1200 characters'), 1400 => t('1400 characters'),
1600 => t('1600 characters'), 1800 => t('1800 characters'), 2000 => t('2000 characters')),
- description => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.")
+ '#description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.")
);
$form['node_preview'] = array(
- type => 'radios', title => t('Preview post'), default_value => variable_get('node_preview', 0),
- options => array(t('Optional'), t('Required')), description => t('Must users preview posts before submitting?')
+ '#type' => 'radios', '#title' => t('Preview post'), '#default_value' => variable_get('node_preview', 0),
+ '#options' => array(t('Optional'), t('Required')), '#description' => t('Must users preview posts before submitting?')
);
return system_settings_form('node_configure', $form);
@@ -847,23 +847,23 @@ function node_filter_form() {
$filters = node_filters();
$i = 0;
- $form['filters'] = array(type => 'fieldset', title => t('Show only items where'), theme => 'node_filters');
+ $form['filters'] = array('#type' => 'fieldset', '#title' => t('Show only items where'), '#theme' => 'node_filters');
foreach ($session as $filter) {
list($type, $value) = $filter;
$string = ($i++ ? '<em>and</em> where <strong>%a</strong> is <strong>%b</strong>' : '<strong>%a</strong> is <strong>%b</strong>');
- $form['filters']['current'][] = array(value => t($string, array('%a' => $filters[$type]['title'] , '%b' => $filters[$type]['options'][$value])));
+ $form['filters']['current'][] = array('#value' => t($string, array('%a' => $filters[$type]['title'] , '%b' => $filters[$type]['options'][$value])));
}
foreach ($filters as $key => $filter) {
$names[$key] = $filter['title'];
- $form['filters']['status'][$key] = array(type => 'select', options => $filter['options']);
+ $form['filters']['status'][$key] = array('#type' => 'select', '#options' => $filter['options']);
}
- $form['filters']['filter'] = array(type => 'radios', options => $names, default_value => 'status');
- $form['filters']['buttons']['submit'] = array(type => 'submit', value => (count($session) ? t('Refine') : t('Filter')));
+ $form['filters']['filter'] = array('#type' => 'radios', '#options' => $names, '#default_value' => 'status');
+ $form['filters']['buttons']['submit'] = array('#type' => 'submit', '#value' => (count($session) ? t('Refine') : t('Filter')));
if (count($session)) {
- $form['filters']['buttons']['undo'] = array(type => 'submit', value => t('Undo'));
- $form['filters']['buttons']['reset'] = array(type => 'submit', value => t('Reset'));
+ $form['filters']['buttons']['undo'] = array('#type' => 'submit', '#value' => t('Undo'));
+ $form['filters']['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
}
return drupal_get_form('node_filter_form', $form);
@@ -968,30 +968,30 @@ function node_admin_nodes() {
$result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);
$form['options'] = array(
- type => 'fieldset', title => t('Update options'),
- prefix => "<div class=\"container-inline\">" , suffix => "</div>"
+ '#type' => 'fieldset', '#title' => t('Update options'),
+ '#prefix' => "<div class=\"container-inline\">" , '#suffix' => "</div>"
);
$options = array();
foreach (node_operations() as $key => $value) {
$options[$key] = $value[0];
}
- $form['options']['operation'] = array(type => 'select', options => $options, default_value => 'approve');
- $form['options']['submit'] = array(type => 'submit', value => t('Update'));
+ $form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'approve');
+ $form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update'));
$destination = drupal_get_destination();
while ($node = db_fetch_object($result)) {
$nodes[$node->nid] = '';
- $form['title'][$node->nid] = array(value => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)));
- $form['name'][$node->nid] = array(value => node_get_name($node));
- $form['username'][$node->nid] = array(value => theme('username', $node));
- $form['status'][$node->nid] = array(value => ($node->status ? t('published') : t('not published')));
- $form['operations'][$node->nid] = array(value => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
+ $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)));
+ $form['name'][$node->nid] = array('#value' => node_get_name($node));
+ $form['username'][$node->nid] = array('#value' => theme('username', $node));
+ $form['status'][$node->nid] = array('#value' => ($node->status ? t('published') : t('not published')));
+ $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
}
- $form['nodes'] = array(type => 'checkboxes', options => $nodes);
+ $form['nodes'] = array('#type' => 'checkboxes', '#options' => $nodes);
$form['pager'] = array('value' => theme('pager', NULL, 50, 0));
- $form[method] = 'post';
- $form[action] = url('admin/node/action');
+ $form['#method'] = 'post';
+ $form['#action'] = url('admin/node/action');
// Call the form first, to allow for the form_values array to be populated.
$output .= drupal_get_form('node_admin_nodes', $form);
@@ -1028,7 +1028,7 @@ function theme_node_admin_nodes($form) {
}
$output .= theme('table', $header, $rows);
- if ($form['pager'][value]) {
+ if ($form['pager']['#value']) {
$output .= form_render($form['pager']);
}
@@ -1037,14 +1037,14 @@ function theme_node_admin_nodes($form) {
function node_multiple_delete_form() {
global $form_values;
- $form['nodes'] = array(prefix => '<ul>', suffix => '</ul>');
+ $form['nodes'] = array('#prefix' => '<ul>', '#suffix' => '</ul>');
foreach ($form_values['nodes'] as $nid => $value) {
if ($value) {
$title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
- $form['nodes'][$nid] = array(type => 'hidden', value => $nid, tree => TRUE, prefix => '<li>', suffix => check_plain($title) .'</li>');
+ $form['nodes'][$nid] = array('#type' => 'hidden', '#value' => $nid, '#tree' => TRUE, '#prefix' => '<li>', '#suffix' => check_plain($title) .'</li>');
}
}
- $form['operation'] = array(type => 'hidden', value => 'delete');
+ $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
return confirm_form('node_multiple_delete_form', $form,
t('Are you sure you want to delete these items?'),
@@ -1071,16 +1071,16 @@ function node_types_configure($type = NULL) {
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
$node = new stdClass();
$node->type = $type;
- $form['submission'] = array(type => 'fieldset', title =>t('Submission form') );
+ $form['submission'] = array('#type' => 'fieldset', '#title' =>t('Submission form') );
$form['submission'][$type . '_help'] = array(
- type => 'textarea', title => t('Explanation or submission guidelines'), default_value => variable_get($type .'_help', ''), cols => 60, rows => 5,
- description => t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_get_name($type)))
+ '#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), '#default_value' => variable_get($type .'_help', ''), '#cols' => 60, '#rows' => 5,
+ '#description' => t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_get_name($type)))
);
$form['submission']['minimum_'. $type .'_size'] = array(
- type => 'select', title => t('Minimum number of words'), default_value => variable_get('minimum_'. $type .'_size', 0), options => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)),
- description => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type)))
+ '#type' => 'select', '#title' => t('Minimum number of words'), '#default_value' => variable_get('minimum_'. $type .'_size', 0), '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)),
+ '#description' => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type)))
);
- $form['workflow'] = array(type => 'fieldset', title =>t('Workflow'));
+ $form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'));
$form['workflow'] = array_merge($form['workflow'], node_invoke_nodeapi($node, 'settings'));
return system_settings_form($type . '_node_settings', $form);
@@ -1393,11 +1393,6 @@ function node_validate($node) {
node_invoke($node, 'validate');
node_invoke_nodeapi($node, 'validate');
- // Check input format access
- if (array_key_exists('format', $node) && !filter_access($node->format)) {
- form_set_error('format', t('The supplied input format is invalid.'));
- }
-
$node->validated = TRUE;
return $node;
@@ -1427,21 +1422,21 @@ function node_form($node) {
}
// Set the id of the top-level form tag
- $form[attributes]['id'] = 'node-form';
+ $form['#attributes']['id'] = 'node-form';
/**
* Basic node information.
* These elements are just values so they are not even sent to the client.
*/
- $form['nid'] = array(type => 'value', value => $node->nid);
- $form['vid'] = array(type => 'value', value => $node->vid);
- $form['uid'] = array(type => 'value', value => $node->uid);
- $form['created'] = array(type => 'value', value => $node->created);
- $form['changed'] = array(type => 'value', value => $node->changed);
- $form['type'] = array(type => 'value', value => $node->type);
+ $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
+ $form['vid'] = array('#type' => 'value', '#value' => $node->vid);
+ $form['uid'] = array('#type' => 'value', '#value' => $node->uid);
+ $form['created'] = array('#type' => 'value', '#value' => $node->created);
+ $form['changed'] = array('#type' => 'value', '#value' => $node->changed);
+ $form['type'] = array('#type' => 'value', '#value' => $node->type);
if ($op == t('Preview')) {
- $form['node_preview'] = array(value => node_preview(array2object($_POST['edit'])), weight => -100);
+ $form['node_preview'] = array('#value' => node_preview(array2object($_POST['edit'])), '#weight' => -100);
}
// Get the node-specific bits.
@@ -1457,37 +1452,39 @@ function node_form($node) {
* Node author information
*/
- $form['author'] = array(type => 'fieldset', title => t('Authoring information'), collapsible => TRUE, collapsed => TRUE, weight => -18);
- $form['author']['name'] = array(type => 'textfield', title => t('Authored by'), maxlength => 60, autocomplete_path => 'user/autocomplete', default_value => $node->name, weight => -1);
- $form['author']['date'] = array(type => 'textfield', title =>t('Authored on'), maxlength => 25, required => TRUE, default_value => $node->date);
+ if (user_access('administer nodes')) {
+ $form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -18);
+ $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name, '#weight' => -1);
+ $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#required' => TRUE, '#default_value' => $node->date);
- $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
+ $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
- /**
- * Node options
- */
- $form['options'] = array(type => 'fieldset', title => t('Publishing options'), collapsible => TRUE, collapsed => TRUE, weight => -18);
- $form['options']['status'] = array(type => 'checkbox', title => t('Published'), default_value => in_array('status', $node_options));
- $form['options']['moderate'] = array(type => 'checkbox', title => t('In moderation queue'), default_value => in_array('moderate', $node_options));
- $form['options']['promote'] = array(type => 'checkbox', title => t('Promoted to front page'), default_value => in_array('promote', $node_options));
- $form['options']['sticky'] = array(type => 'checkbox', title =>t('Sticky at top of lists'), default_value => in_array('sticky', $node_options));
- $form['options']['revision'] = array(type => 'checkbox', title =>t('Create new revision'), default_value => in_array('revision', $node_options));
+ /**
+ * Node options
+ */
+ $form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -18);
+ $form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => in_array('status', $node_options));
+ $form['options']['moderate'] = array('#type' => 'checkbox', '#title' => t('In moderation queue'), '#default_value' => in_array('moderate', $node_options));
+ $form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => in_array('promote', $node_options));
+ $form['options']['sticky'] = array('#type' => 'checkbox', '#title' =>t('Sticky at top of lists'), '#default_value' => in_array('sticky', $node_options));
+ $form['options']['revision'] = array('#type' => 'checkbox', '#title' =>t('Create new revision'), '#default_value' => in_array('revision', $node_options));
+ }
$nodeapi = node_invoke_nodeapi($node, 'form');
if (is_array($nodeapi)) {
foreach ($nodeapi as $key => $element) {
- $nodeapi[$key][weight] = isset($nodeapi[$key][weight]) ? $nodeapi[$key][weight] : -18;
+ $nodeapi[$key]['#weight'] = isset($nodeapi[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
}
// Append extra node form elements.
$form = array_merge($form, $nodeapi);
}
- $form['title'][weight] = isset($form['title'][weight]) ? $form['title'][weight] : -17;
- $form['body'][weight] = isset($form['body'][weight]) ? $form['body'][weight] : -5;
+ $form['title']['#weight'] = isset($form['title']['#weight']) ? $form['title']['#weight'] : -17;
+ $form['body']['#weight'] = isset($form['body']['#weight']) ? $form['body']['#weight'] : -5;
// Add the buttons.
- $form['preview'] = array(type => 'button', value => t('Preview'), weight => 19);
+ $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 19);
if ($node->type) {
if (!form_get_errors()) {
@@ -1496,9 +1493,9 @@ function node_form($node) {
}
}
}
- $form['submit'] = array(type => 'submit', value => t('Submit'), weight => 20);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
if ($node->nid && node_access('delete', $node)) {
- $form['delete'] = array(type => 'button', value => t('Delete'), weight => 21);
+ $form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 21);
}
return drupal_get_form($node->type . '_node_form', $form, 'node_form');
}
@@ -1687,7 +1684,7 @@ function node_delete($edit) {
$node = node_load($edit['nid']);
if (node_access('delete', $node)) {
- $form['nid'] = array(type => 'hidden', value => $node->nid);
+ $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
$output = confirm_form('node_delete_confirm', $form,
t('Are you sure you want to delete %title?', array('%title' => theme('placeholder', $node->title))),
$_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid, t('This action cannot be undone.'),
@@ -1908,10 +1905,10 @@ function node_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'settings':
$form['node_options_'. $node->type] = array(
- type => 'checkboxes', title => t('Default options'), default_value => variable_get('node_options_'. $node->type, array('status', 'promote')),
- options => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'),
+ '#type' => 'checkboxes', '#title' => t('Default options'), '#default_value' => variable_get('node_options_'. $node->type, array('status', 'promote')),
+ '#options' => array('status' => t('Published'), 'moderate' => t('In moderation queue'), 'promote' => t('Promoted to front page'),
'sticky' => t('Sticky at top of lists'), 'revision' => t('Create new revision')),
- description => t('Users with the <em>administer nodes</em> permission will be able to override these options.')
+ '#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.')
);
return $form;
}
diff --git a/modules/page.module b/modules/page.module
index 81610551a..b9749105e 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -75,21 +75,17 @@ function page_validate(&$node) {
*/
function page_form(&$node) {
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
-
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('page', $node);
- }
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array(
- type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
$form['log'] = array(
- type => 'textarea', title => t('Log message'), default_value => $node->log, rows => 5,
- description => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#rows' => 5,
+ '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
return $form;
diff --git a/modules/page/page.module b/modules/page/page.module
index 81610551a..b9749105e 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -75,21 +75,17 @@ function page_validate(&$node) {
*/
function page_form(&$node) {
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
-
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('page', $node);
- }
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array(
- type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
$form['log'] = array(
- type => 'textarea', title => t('Log message'), default_value => $node->log, rows => 5,
- description => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#rows' => 5,
+ '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
return $form;
diff --git a/modules/path.module b/modules/path.module
index 147612ea8..2ef57f190 100644
--- a/modules/path.module
+++ b/modules/path.module
@@ -158,15 +158,15 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL) {
*/
function path_form($edit = '') {
- $form['src'] = array(type => 'textfield', title => t('Existing system path'), default_value => $edit['src'], size => 60, maxlength => 64, description => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'));
- $form['dst'] = array(type => 'textfield', default_value => $edit['dst'], size => 60, maxlength => 64, description => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
+ $form['src'] = array('#type' => 'textfield', '#title' => t('Existing system path'), '#default_value' => $edit['src'], '#size' => 60, '#maxlength' => 64, '#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'));
+ $form['dst'] = array('#type' => 'textfield', '#default_value' => $edit['dst'], '#size' => 60, '#maxlength' => 64, '#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
if ($edit['pid']) {
- $form['pid'] = array(type => 'hidden', value => $edit['pid']);
- $form['submit'] = array(type => 'submit', value => t('Update alias'));
+ $form['pid'] = array('#type' => 'hidden', '#value' => $edit['pid']);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Update alias'));
}
else {
- $form['submit'] = array(type => 'submit', value => t('Create new alias'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Create new alias'));
}
return drupal_get_form('path_form', $form);
@@ -192,9 +192,9 @@ function path_nodeapi(&$node, $op, $arg) {
break;
case 'form':
- $form['path'] = array(type => 'textfield', title => t('Path alias'), weight => -16, default_value => $node->path, size => 60, maxlength => 250, description => t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
+ $form['path'] = array('#type' => 'textfield', '#title' => t('Path alias'), '#weight' => -16, '#default_value' => $node->path, '#size' => 60, '#maxlength' => 250, '#description' => t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
if ($node->path) {
- $form['pid'] = array(type => 'hidden', value => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s'", $node->path)));
+ $form['pid'] = array('#type' => 'hidden', '#value' => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s'", $node->path)));
}
return $form;
diff --git a/modules/path/path.module b/modules/path/path.module
index 147612ea8..2ef57f190 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -158,15 +158,15 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL) {
*/
function path_form($edit = '') {
- $form['src'] = array(type => 'textfield', title => t('Existing system path'), default_value => $edit['src'], size => 60, maxlength => 64, description => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'));
- $form['dst'] = array(type => 'textfield', default_value => $edit['dst'], size => 60, maxlength => 64, description => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
+ $form['src'] = array('#type' => 'textfield', '#title' => t('Existing system path'), '#default_value' => $edit['src'], '#size' => 60, '#maxlength' => 64, '#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'));
+ $form['dst'] = array('#type' => 'textfield', '#default_value' => $edit['dst'], '#size' => 60, '#maxlength' => 64, '#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
if ($edit['pid']) {
- $form['pid'] = array(type => 'hidden', value => $edit['pid']);
- $form['submit'] = array(type => 'submit', value => t('Update alias'));
+ $form['pid'] = array('#type' => 'hidden', '#value' => $edit['pid']);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Update alias'));
}
else {
- $form['submit'] = array(type => 'submit', value => t('Create new alias'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Create new alias'));
}
return drupal_get_form('path_form', $form);
@@ -192,9 +192,9 @@ function path_nodeapi(&$node, $op, $arg) {
break;
case 'form':
- $form['path'] = array(type => 'textfield', title => t('Path alias'), weight => -16, default_value => $node->path, size => 60, maxlength => 250, description => t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
+ $form['path'] = array('#type' => 'textfield', '#title' => t('Path alias'), '#weight' => -16, '#default_value' => $node->path, '#size' => 60, '#maxlength' => 250, '#description' => t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
if ($node->path) {
- $form['pid'] = array(type => 'hidden', value => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s'", $node->path)));
+ $form['pid'] = array('#type' => 'hidden', '#value' => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s'", $node->path)));
}
return $form;
diff --git a/modules/poll.module b/modules/poll.module
index 57a8954df..52765dd48 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -123,11 +123,7 @@ function poll_validate(&$node) {
function poll_form(&$node) {
$admin = user_access('administer nodes');
- $form['title'] = array(type => 'textfield', title => t('Question'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title, weight => -1);
-
- if (function_exists('taxonomy_node_form')) {
- $output .= implode('', taxonomy_node_form('poll', $node));
- }
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Question'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title, '#weight' => -1);
if (!isset($node->choices)) {
$node->choices = max(2, count($node->choice) ? count($node->choice) : 5);
@@ -140,25 +136,25 @@ function poll_form(&$node) {
// Poll choices
$opts = drupal_map_assoc(range(2, $node->choices * 2 + 5));
- $form['choice'] = array(type => 'fieldset', title => t('Choices'), prefix => '<div class="poll-form">', suffix => '</div>', tree => TRUE);
+ $form['choice'] = array('#type' => 'fieldset', '#title' => t('Choices'), '#prefix' => '<div class="poll-form">', '#suffix' => '</div>', '#tree' => TRUE);
for ($a = 0; $a < $node->choices; $a++) {
- $form['choice'][$a]['chtext'] = array(type => 'textfield', title => t('Choice %n', array('%n' => ($a + 1))), default_value => $node->choice[$a]['chtext'], size => 60, maxlength => 127);
+ $form['choice'][$a]['chtext'] = array('#type' => 'textfield', '#title' => t('Choice %n', array('%n' => ($a + 1))), '#default_value' => $node->choice[$a]['chtext'], '#size' => 60, '#maxlength' => 127);
if ($admin) {
- $form['choice'][$a]['chvotes'] = array(type => 'textfield', title => t('Votes for choice %n', array('%n' => ($a + 1))), default_value => (int)$node->choice[$a]['chvotes'], size => 5, maxlength => 7);
+ $form['choice'][$a]['chvotes'] = array('#type' => 'textfield', '#title' => t('Votes for choice %n', array('%n' => ($a + 1))), '#default_value' => (int)$node->choice[$a]['chvotes'], '#size' => 5, '#maxlength' => 7);
}
}
- $form['choices'] = array(type => 'hidden', value => $node->choices);
- $form['morechoices'] = array(type => 'checkbox', title => t('Need more choices'), return_value => 1, default_value => 0, description => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."));
+ $form['choices'] = array('#type' => 'hidden', '#value' => $node->choices);
+ $form['morechoices'] = array('#type' => 'checkbox', '#title' => t('Need more choices'), '#return_value' => 1, '#default_value' => 0, '#description' => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."));
// Poll attributes
$_duration = array(0 => t('Unlimited')) + drupal_map_assoc(array(86400, 172800, 345600, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), "format_interval");
$_active = array(0 => t('Closed'), 1 => t('Active'));
if ($admin) {
- $form['settings'] = array(type => 'fieldset', title => t('Settings'), suffix => '</div>');
- $form['settings']['active'] = array(type => 'radios', title => t('Poll status'), default_value => isset($node->active) ? $node->active : 1, options => $_active, description => t('When a poll is closed, visitors can no longer vote for it.'));
+ $form['settings'] = array('#type' => 'fieldset', '#title' => t('Settings'), '#suffix' => '</div>');
+ $form['settings']['active'] = array('#type' => 'radios', '#title' => t('Poll status'), '#default_value' => isset($node->active) ? $node->active : 1, '#options' => $_active, '#description' => t('When a poll is closed, visitors can no longer vote for it.'));
}
- $form['settings']['runtime'] = array(type => 'select', title => t('Poll duration'), default_value => $node->runtime ? $node->runtime : 0, options => $_duration, description => t('After this period, the poll will be closed automatically.'));
+ $form['settings']['runtime'] = array('#type' => 'select', '#title' => t('Poll duration'), '#default_value' => $node->runtime ? $node->runtime : 0, '#options' => $_duration, '#description' => t('After this period, the poll will be closed automatically.'));
return $form;
}
@@ -310,10 +306,10 @@ function poll_view_voting(&$node, $teaser, $page, $block) {
foreach ($node->choice as $i => $choice) {
$list[$i] = check_plain($choice['chtext']);
}
- $form['choice'] = array(type => 'radios', title => $page ? '' : check_plain($node->title), default_value => -1, options => $list);
+ $form['choice'] = array('#type' => 'radios', '#title' => $page ? '' : check_plain($node->title), '#default_value' => -1, '#options' => $list);
}
- $form['nid'] = array(type => 'hidden', value => $node->nid);
- $form['vote'] = array(type => 'submit', value => t('Vote'));
+ $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
+ $form['vote'] = array('#type' => 'submit', '#value' => t('Vote'));
return drupal_get_form('poll_view_voting', $form);
}
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 57a8954df..52765dd48 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -123,11 +123,7 @@ function poll_validate(&$node) {
function poll_form(&$node) {
$admin = user_access('administer nodes');
- $form['title'] = array(type => 'textfield', title => t('Question'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title, weight => -1);
-
- if (function_exists('taxonomy_node_form')) {
- $output .= implode('', taxonomy_node_form('poll', $node));
- }
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Question'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title, '#weight' => -1);
if (!isset($node->choices)) {
$node->choices = max(2, count($node->choice) ? count($node->choice) : 5);
@@ -140,25 +136,25 @@ function poll_form(&$node) {
// Poll choices
$opts = drupal_map_assoc(range(2, $node->choices * 2 + 5));
- $form['choice'] = array(type => 'fieldset', title => t('Choices'), prefix => '<div class="poll-form">', suffix => '</div>', tree => TRUE);
+ $form['choice'] = array('#type' => 'fieldset', '#title' => t('Choices'), '#prefix' => '<div class="poll-form">', '#suffix' => '</div>', '#tree' => TRUE);
for ($a = 0; $a < $node->choices; $a++) {
- $form['choice'][$a]['chtext'] = array(type => 'textfield', title => t('Choice %n', array('%n' => ($a + 1))), default_value => $node->choice[$a]['chtext'], size => 60, maxlength => 127);
+ $form['choice'][$a]['chtext'] = array('#type' => 'textfield', '#title' => t('Choice %n', array('%n' => ($a + 1))), '#default_value' => $node->choice[$a]['chtext'], '#size' => 60, '#maxlength' => 127);
if ($admin) {
- $form['choice'][$a]['chvotes'] = array(type => 'textfield', title => t('Votes for choice %n', array('%n' => ($a + 1))), default_value => (int)$node->choice[$a]['chvotes'], size => 5, maxlength => 7);
+ $form['choice'][$a]['chvotes'] = array('#type' => 'textfield', '#title' => t('Votes for choice %n', array('%n' => ($a + 1))), '#default_value' => (int)$node->choice[$a]['chvotes'], '#size' => 5, '#maxlength' => 7);
}
}
- $form['choices'] = array(type => 'hidden', value => $node->choices);
- $form['morechoices'] = array(type => 'checkbox', title => t('Need more choices'), return_value => 1, default_value => 0, description => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."));
+ $form['choices'] = array('#type' => 'hidden', '#value' => $node->choices);
+ $form['morechoices'] = array('#type' => 'checkbox', '#title' => t('Need more choices'), '#return_value' => 1, '#default_value' => 0, '#description' => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."));
// Poll attributes
$_duration = array(0 => t('Unlimited')) + drupal_map_assoc(array(86400, 172800, 345600, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), "format_interval");
$_active = array(0 => t('Closed'), 1 => t('Active'));
if ($admin) {
- $form['settings'] = array(type => 'fieldset', title => t('Settings'), suffix => '</div>');
- $form['settings']['active'] = array(type => 'radios', title => t('Poll status'), default_value => isset($node->active) ? $node->active : 1, options => $_active, description => t('When a poll is closed, visitors can no longer vote for it.'));
+ $form['settings'] = array('#type' => 'fieldset', '#title' => t('Settings'), '#suffix' => '</div>');
+ $form['settings']['active'] = array('#type' => 'radios', '#title' => t('Poll status'), '#default_value' => isset($node->active) ? $node->active : 1, '#options' => $_active, '#description' => t('When a poll is closed, visitors can no longer vote for it.'));
}
- $form['settings']['runtime'] = array(type => 'select', title => t('Poll duration'), default_value => $node->runtime ? $node->runtime : 0, options => $_duration, description => t('After this period, the poll will be closed automatically.'));
+ $form['settings']['runtime'] = array('#type' => 'select', '#title' => t('Poll duration'), '#default_value' => $node->runtime ? $node->runtime : 0, '#options' => $_duration, '#description' => t('After this period, the poll will be closed automatically.'));
return $form;
}
@@ -310,10 +306,10 @@ function poll_view_voting(&$node, $teaser, $page, $block) {
foreach ($node->choice as $i => $choice) {
$list[$i] = check_plain($choice['chtext']);
}
- $form['choice'] = array(type => 'radios', title => $page ? '' : check_plain($node->title), default_value => -1, options => $list);
+ $form['choice'] = array('#type' => 'radios', '#title' => $page ? '' : check_plain($node->title), '#default_value' => -1, '#options' => $list);
}
- $form['nid'] = array(type => 'hidden', value => $node->nid);
- $form['vote'] = array(type => 'submit', value => t('Vote'));
+ $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
+ $form['vote'] = array('#type' => 'submit', '#value' => t('Vote'));
return drupal_get_form('poll_view_voting', $form);
}
diff --git a/modules/profile.module b/modules/profile.module
index bbebb1106..c49a414b7 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -44,7 +44,7 @@ function profile_block($op = 'list', $delta = 0, $edit = array()) {
$fields[$record->name] = $record->title;
}
$fields['user_profile'] = t('Link to full user profile');
- $form['profile_block_author_fields'] = array(type => 'checkboxes', title => t('Profile fields to display'), default_value => variable_get('profile_block_author_fields', NULL), options => $fields, description => t('Select which profile fields you wish to display in the block. Only fields designated as public in the <a href="%profile-admin">profile field configuration</a> are available.', array('%profile-admin' => url('admin/settings/profile'))));
+ $form['profile_block_author_fields'] = array('#type' => 'checkboxes', '#title' => t('Profile fields to display'), '#default_value' => variable_get('profile_block_author_fields', NULL), '#options' => $fields, '#description' => t('Select which profile fields you wish to display in the block. Only fields designated as public in the <a href="%profile-admin">profile field configuration</a> are available.', array('%profile-admin' => url('admin/settings/profile'))));
return $form;
}
else if ($op == 'save' && $delta == 0) {
@@ -297,7 +297,7 @@ function profile_view_profile($user) {
if ($value = profile_view_field($user, $field)) {
$description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
$title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
- $form = array(type => 'item', title => $title, value => $value, description => $description);
+ $form = array('#type' => 'item', '#title' => $title, '#value' => $value, '#description' => $description);
$fields[$field->category][$field->name] = form_render(_form_builder($form));
}
}
@@ -330,23 +330,23 @@ function profile_form_profile($edit, $user, $category) {
}
// Only add form group if items exist
if (db_num_rows($result)) {
- $fields[$category] = array(type => 'fieldset', title => $category);
+ $fields[$category] = array('#type' => 'fieldset', '#title' => $category);
}
while ($field = db_fetch_object($result)) {
$category = $field->category;
switch ($field->type) {
case 'textfield':
case 'url':
- $fields[$category][$field->name] = array(type => 'textfield', title => check_plain($field->title), default_value => $edit[$field->name], size => 60, maxlength => 255, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'textfield', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#size' => 60, '#maxlength' => 255, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'textarea':
- $fields[$category][$field->name] = array(type => 'textarea', title => check_plain($field->title), default_value => $edit[$field->name], cols => 60, rows => 5, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'textarea', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#cols' => 60, '#rows' => 5, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'list':
- $fields[$category][$field->name] = array(type => 'textarea', title => check_plain($field->title), default_value => $edit[$field->name], cols => 60, rows => 5, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'textarea', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#cols' => 60, '#rows' => 5, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'checkbox':
- $fields[$category][$field->name] = array(type => 'checkbox', title => check_plain($field->title), return_value => 1, default_value => $edit[$field->name], description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'checkbox', '#title' => check_plain($field->title), '#return_value' => 1, '#default_value' => $edit[$field->name], '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'selection':
$options = array('--');
@@ -356,10 +356,10 @@ function profile_form_profile($edit, $user, $category) {
$options[$line] = $line;
}
}
- $fields[$category][$field->name] = array(type => 'select', title => check_plain($field->title), default_value => $edit[$field->name], options => $options, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'select', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#options' => $options, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'date':
- $fields[$category][$field->name] = array(type => 'date', title => check_plain($field->title), default_value => $edit[$field->name], description, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'date', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], description, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
}
}
@@ -549,26 +549,26 @@ function profile_admin_delete($fid) {
function _profile_field_form($type, $edit = array()) {
- $form['fields'] = array(type => 'fieldset', title => t('Field settings'));
- $form['fields']['category'] = array(type => 'textfield', title => t('Category'), default_value => $edit['category'], size => 60, maxlength => 128, description => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'));
- $form['fields']['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 128, description => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'));
- $form['fields']['name'] = array(type => 'textfield', title => t('Form name'), default_value => $edit['name'], size => 60, maxlength => 128, description => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
+ $form['fields'] = array('#type' => 'fieldset', '#title' => t('Field settings'));
+ $form['fields']['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#default_value' => $edit['category'], '#size' => 60, '#maxlength' => 128, '#description' => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'));
+ $form['fields']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 128, '#description' => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'));
+ $form['fields']['name'] = array('#type' => 'textfield', '#title' => t('Form name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 128, '#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
Unless you know what you are doing, it is highly recommended that you prefix the form name with <code>profile_</code> to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'));
- $form['fields']['explanation'] = array(type => 'textarea', title => t('Explanation'), default_value => $edit['explanation'], cols => 60, rows => 5, description => t('An optional explanation to go with the new field. The explanation will be shown to the user.'));
+ $form['fields']['explanation'] = array('#type' => 'textarea', '#title' => t('Explanation'), '#default_value' => $edit['explanation'], '#cols' => 60, '#rows' => 5, '#description' => t('An optional explanation to go with the new field. The explanation will be shown to the user.'));
if ($type == 'selection') {
- $form['fields']['options'] = array(type => 'textarea', title => t('Selection options'), default_value => $edit['options'], cols => 60, rows => 5, description => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'));
+ $form['fields']['options'] = array('#type' => 'textarea', '#title' => t('Selection options'), '#default_value' => $edit['options'], '#cols' => 60, '#rows' => 5, '#description' => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'));
}
- $form['fields']['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 5, description => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'));
- $form['fields']['visibility'] = array(type => 'radios', title => t('Visibility'), default_value => $edit['visibility'], options => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')));
+ $form['fields']['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 5, '#description' => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'));
+ $form['fields']['visibility'] = array('#type' => 'radios', '#title' => t('Visibility'), '#default_value' => $edit['visibility'], '#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')));
if ($type == 'selection' || $type == 'list') {
- $form['fields']['page'] = array(type => 'textfield', title => t('Page title'), default_value => $edit['page'], size => 60, maxlength => 128, description => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". Only applicable if the field is configured to be shown on member list pages.'));
+ $form['fields']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], '#size' => 60, '#maxlength' => 128, '#description' => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". Only applicable if the field is configured to be shown on member list pages.'));
}
else {
- $form['fields']['page'] = array(type => 'textfield', title => t('Page title'), default_value => $edit['page'], size => 60, maxlength => 128, description => t('The title of the page showing all users with the specified field. Only applicable if the field is configured to be shown on member listings.'));
+ $form['fields']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], '#size' => 60, '#maxlength' => 128, '#description' => t('The title of the page showing all users with the specified field. Only applicable if the field is configured to be shown on member listings.'));
}
- $form['fields']['required'] = array(type => 'checkbox', title => t('The user must enter a value.'), return_value => 1, default_value => $edit['required']);
- $form['fields']['register'] = array(type => 'checkbox', title => t('Visible in user registration form.'), return_value => 1, default_value => $edit['register']);
- $form['submit'] = array(type => 'submit', value => t('Save field'));
+ $form['fields']['required'] = array('#type' => 'checkbox', '#title' => t('The user must enter a value.'), '#return_value' => 1, '#default_value' => $edit['required']);
+ $form['fields']['register'] = array('#type' => 'checkbox', '#title' => t('Visible in user registration form.'), '#return_value' => 1, '#default_value' => $edit['register']);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save field'));
return drupal_get_form('_profile_field_form', $form);
}
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index bbebb1106..c49a414b7 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -44,7 +44,7 @@ function profile_block($op = 'list', $delta = 0, $edit = array()) {
$fields[$record->name] = $record->title;
}
$fields['user_profile'] = t('Link to full user profile');
- $form['profile_block_author_fields'] = array(type => 'checkboxes', title => t('Profile fields to display'), default_value => variable_get('profile_block_author_fields', NULL), options => $fields, description => t('Select which profile fields you wish to display in the block. Only fields designated as public in the <a href="%profile-admin">profile field configuration</a> are available.', array('%profile-admin' => url('admin/settings/profile'))));
+ $form['profile_block_author_fields'] = array('#type' => 'checkboxes', '#title' => t('Profile fields to display'), '#default_value' => variable_get('profile_block_author_fields', NULL), '#options' => $fields, '#description' => t('Select which profile fields you wish to display in the block. Only fields designated as public in the <a href="%profile-admin">profile field configuration</a> are available.', array('%profile-admin' => url('admin/settings/profile'))));
return $form;
}
else if ($op == 'save' && $delta == 0) {
@@ -297,7 +297,7 @@ function profile_view_profile($user) {
if ($value = profile_view_field($user, $field)) {
$description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
$title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
- $form = array(type => 'item', title => $title, value => $value, description => $description);
+ $form = array('#type' => 'item', '#title' => $title, '#value' => $value, '#description' => $description);
$fields[$field->category][$field->name] = form_render(_form_builder($form));
}
}
@@ -330,23 +330,23 @@ function profile_form_profile($edit, $user, $category) {
}
// Only add form group if items exist
if (db_num_rows($result)) {
- $fields[$category] = array(type => 'fieldset', title => $category);
+ $fields[$category] = array('#type' => 'fieldset', '#title' => $category);
}
while ($field = db_fetch_object($result)) {
$category = $field->category;
switch ($field->type) {
case 'textfield':
case 'url':
- $fields[$category][$field->name] = array(type => 'textfield', title => check_plain($field->title), default_value => $edit[$field->name], size => 60, maxlength => 255, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'textfield', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#size' => 60, '#maxlength' => 255, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'textarea':
- $fields[$category][$field->name] = array(type => 'textarea', title => check_plain($field->title), default_value => $edit[$field->name], cols => 60, rows => 5, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'textarea', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#cols' => 60, '#rows' => 5, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'list':
- $fields[$category][$field->name] = array(type => 'textarea', title => check_plain($field->title), default_value => $edit[$field->name], cols => 60, rows => 5, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'textarea', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#cols' => 60, '#rows' => 5, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'checkbox':
- $fields[$category][$field->name] = array(type => 'checkbox', title => check_plain($field->title), return_value => 1, default_value => $edit[$field->name], description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'checkbox', '#title' => check_plain($field->title), '#return_value' => 1, '#default_value' => $edit[$field->name], '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'selection':
$options = array('--');
@@ -356,10 +356,10 @@ function profile_form_profile($edit, $user, $category) {
$options[$line] = $line;
}
}
- $fields[$category][$field->name] = array(type => 'select', title => check_plain($field->title), default_value => $edit[$field->name], options => $options, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'select', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#options' => $options, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
case 'date':
- $fields[$category][$field->name] = array(type => 'date', title => check_plain($field->title), default_value => $edit[$field->name], description, description => _profile_form_explanation($field), required => $field->required);
+ $fields[$category][$field->name] = array('#type' => 'date', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], description, '#description' => _profile_form_explanation($field), '#required' => $field->required);
break;
}
}
@@ -549,26 +549,26 @@ function profile_admin_delete($fid) {
function _profile_field_form($type, $edit = array()) {
- $form['fields'] = array(type => 'fieldset', title => t('Field settings'));
- $form['fields']['category'] = array(type => 'textfield', title => t('Category'), default_value => $edit['category'], size => 60, maxlength => 128, description => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'));
- $form['fields']['title'] = array(type => 'textfield', title => t('Title'), default_value => $edit['title'], size => 60, maxlength => 128, description => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'));
- $form['fields']['name'] = array(type => 'textfield', title => t('Form name'), default_value => $edit['name'], size => 60, maxlength => 128, description => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
+ $form['fields'] = array('#type' => 'fieldset', '#title' => t('Field settings'));
+ $form['fields']['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#default_value' => $edit['category'], '#size' => 60, '#maxlength' => 128, '#description' => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'));
+ $form['fields']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 128, '#description' => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'));
+ $form['fields']['name'] = array('#type' => 'textfield', '#title' => t('Form name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 128, '#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
Unless you know what you are doing, it is highly recommended that you prefix the form name with <code>profile_</code> to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'));
- $form['fields']['explanation'] = array(type => 'textarea', title => t('Explanation'), default_value => $edit['explanation'], cols => 60, rows => 5, description => t('An optional explanation to go with the new field. The explanation will be shown to the user.'));
+ $form['fields']['explanation'] = array('#type' => 'textarea', '#title' => t('Explanation'), '#default_value' => $edit['explanation'], '#cols' => 60, '#rows' => 5, '#description' => t('An optional explanation to go with the new field. The explanation will be shown to the user.'));
if ($type == 'selection') {
- $form['fields']['options'] = array(type => 'textarea', title => t('Selection options'), default_value => $edit['options'], cols => 60, rows => 5, description => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'));
+ $form['fields']['options'] = array('#type' => 'textarea', '#title' => t('Selection options'), '#default_value' => $edit['options'], '#cols' => 60, '#rows' => 5, '#description' => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'));
}
- $form['fields']['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 5, description => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'));
- $form['fields']['visibility'] = array(type => 'radios', title => t('Visibility'), default_value => $edit['visibility'], options => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')));
+ $form['fields']['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 5, '#description' => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'));
+ $form['fields']['visibility'] = array('#type' => 'radios', '#title' => t('Visibility'), '#default_value' => $edit['visibility'], '#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')));
if ($type == 'selection' || $type == 'list') {
- $form['fields']['page'] = array(type => 'textfield', title => t('Page title'), default_value => $edit['page'], size => 60, maxlength => 128, description => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". Only applicable if the field is configured to be shown on member list pages.'));
+ $form['fields']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], '#size' => 60, '#maxlength' => 128, '#description' => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". Only applicable if the field is configured to be shown on member list pages.'));
}
else {
- $form['fields']['page'] = array(type => 'textfield', title => t('Page title'), default_value => $edit['page'], size => 60, maxlength => 128, description => t('The title of the page showing all users with the specified field. Only applicable if the field is configured to be shown on member listings.'));
+ $form['fields']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], '#size' => 60, '#maxlength' => 128, '#description' => t('The title of the page showing all users with the specified field. Only applicable if the field is configured to be shown on member listings.'));
}
- $form['fields']['required'] = array(type => 'checkbox', title => t('The user must enter a value.'), return_value => 1, default_value => $edit['required']);
- $form['fields']['register'] = array(type => 'checkbox', title => t('Visible in user registration form.'), return_value => 1, default_value => $edit['register']);
- $form['submit'] = array(type => 'submit', value => t('Save field'));
+ $form['fields']['required'] = array('#type' => 'checkbox', '#title' => t('The user must enter a value.'), '#return_value' => 1, '#default_value' => $edit['required']);
+ $form['fields']['register'] = array('#type' => 'checkbox', '#title' => t('Visible in user registration form.'), '#return_value' => 1, '#default_value' => $edit['register']);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save field'));
return drupal_get_form('_profile_field_form', $form);
}
diff --git a/modules/search.module b/modules/search.module
index 51286d631..adc020eb5 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -143,19 +143,19 @@ function search_settings() {
$count = format_plural($remaining, 'There is 1 item left to index.', 'There are %count items left to index.');
$percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
$status = '<p><strong>'. t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) .' '. $count .'</strong></p>';
- $form['search_admin'] = array(type => 'fieldset', title => t('Indexing status'));
- $form['search_admin']['status'] = array(type => 'markup', value => $status);
+ $form['search_admin'] = array('#type' => 'fieldset', '#title' => t('Indexing status'));
+ $form['search_admin']['status'] = array('#type' => 'markup', '#value' => $status);
$items = drupal_map_assoc(array(10, 20, 50, 100, 200, 500));
// Indexing throttle:
- $form['indexing_throttle'] = array(type => 'fieldset', title => t('Indexing throttle'));
- $form['indexing_throttle']['search_cron_limit'] = array(type => 'select', title => t('Items to index per cron run'), default_value => variable_get('search_cron_limit', 100), options => $items, description => t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'));
+ $form['indexing_throttle'] = array('#type' => 'fieldset', '#title' => t('Indexing throttle'));
+ $form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Items to index per cron run'), '#default_value' => variable_get('search_cron_limit', 100), '#options' => $items, '#description' => t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'));
// Indexing settings:
- $form['indexing_settings'] = array(type => 'fieldset', title => t('Indexing settings'));
- $form['indexing_settings']['info'] = array(type => 'markup', value => '<em>'. t('<p>Changing the setting below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
- $form['indexing_settings']['minimum_word_size'] = array(type => 'textfield', title => t('Minimum word length to index'), default_value => variable_get('minimum_word_size', 3), size => 5, maxlength => 3, description => t('The number of characters a word has to be to be indexed. Words shorter than this will not be searchable.'));
- $form['indexing_settings']['remove_short'] = array(type => 'textfield', title => t('Minimum word length to search for'), default_value => variable_get('remove_short', 3), size => 5, maxlength => 3, description => t('The number of characters a word has to be to be searched for, including wildcard characters.'));
+ $form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings'));
+ $form['indexing_settings']['info'] = array('#type' => 'markup', '#value' => '<em>'. t('<p>Changing the setting below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
+ $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. Words shorter than this will not be searchable.'));
+ $form['indexing_settings']['remove_short'] = array('#type' => 'textfield', '#title' => t('Minimum word length to search for'), '#default_value' => variable_get('remove_short', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be searched for, including wildcard characters.'));
return $form;
}
@@ -647,11 +647,11 @@ function search_form($action = '', $keys = '', $type = null, $prompt = null) {
$prompt = t('Enter your keywords');
}
- $form[action] = $action;
- $form['prompt'] = array(type => 'item', title => $prompt);
- $form['keys'] = array(type => 'textfield', title => '', default_value => $keys, size => $prompt ? 40 : 30, maxlength => 255);
- $form['submit'] = array(type => 'submit', value => t('Search'));
- $form[attributes] = array('class' => 'search-form');
+ $form['#action'] = $action;
+ $form['prompt'] = array('#type' => 'item', '#title' => $prompt);
+ $form['keys'] = array('#type' => 'textfield', '#title' => '', '#default_value' => $keys, '#size' => $prompt ? 40 : 30, '#maxlength' => 255);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
+ $form['#attributes'] = array('class' => 'search-form');
return drupal_get_form('search_form', $form);
}
diff --git a/modules/search/search.module b/modules/search/search.module
index 51286d631..adc020eb5 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -143,19 +143,19 @@ function search_settings() {
$count = format_plural($remaining, 'There is 1 item left to index.', 'There are %count items left to index.');
$percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
$status = '<p><strong>'. t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) .' '. $count .'</strong></p>';
- $form['search_admin'] = array(type => 'fieldset', title => t('Indexing status'));
- $form['search_admin']['status'] = array(type => 'markup', value => $status);
+ $form['search_admin'] = array('#type' => 'fieldset', '#title' => t('Indexing status'));
+ $form['search_admin']['status'] = array('#type' => 'markup', '#value' => $status);
$items = drupal_map_assoc(array(10, 20, 50, 100, 200, 500));
// Indexing throttle:
- $form['indexing_throttle'] = array(type => 'fieldset', title => t('Indexing throttle'));
- $form['indexing_throttle']['search_cron_limit'] = array(type => 'select', title => t('Items to index per cron run'), default_value => variable_get('search_cron_limit', 100), options => $items, description => t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'));
+ $form['indexing_throttle'] = array('#type' => 'fieldset', '#title' => t('Indexing throttle'));
+ $form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Items to index per cron run'), '#default_value' => variable_get('search_cron_limit', 100), '#options' => $items, '#description' => t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'));
// Indexing settings:
- $form['indexing_settings'] = array(type => 'fieldset', title => t('Indexing settings'));
- $form['indexing_settings']['info'] = array(type => 'markup', value => '<em>'. t('<p>Changing the setting below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
- $form['indexing_settings']['minimum_word_size'] = array(type => 'textfield', title => t('Minimum word length to index'), default_value => variable_get('minimum_word_size', 3), size => 5, maxlength => 3, description => t('The number of characters a word has to be to be indexed. Words shorter than this will not be searchable.'));
- $form['indexing_settings']['remove_short'] = array(type => 'textfield', title => t('Minimum word length to search for'), default_value => variable_get('remove_short', 3), size => 5, maxlength => 3, description => t('The number of characters a word has to be to be searched for, including wildcard characters.'));
+ $form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings'));
+ $form['indexing_settings']['info'] = array('#type' => 'markup', '#value' => '<em>'. t('<p>Changing the setting below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
+ $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. Words shorter than this will not be searchable.'));
+ $form['indexing_settings']['remove_short'] = array('#type' => 'textfield', '#title' => t('Minimum word length to search for'), '#default_value' => variable_get('remove_short', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be searched for, including wildcard characters.'));
return $form;
}
@@ -647,11 +647,11 @@ function search_form($action = '', $keys = '', $type = null, $prompt = null) {
$prompt = t('Enter your keywords');
}
- $form[action] = $action;
- $form['prompt'] = array(type => 'item', title => $prompt);
- $form['keys'] = array(type => 'textfield', title => '', default_value => $keys, size => $prompt ? 40 : 30, maxlength => 255);
- $form['submit'] = array(type => 'submit', value => t('Search'));
- $form[attributes] = array('class' => 'search-form');
+ $form['#action'] = $action;
+ $form['prompt'] = array('#type' => 'item', '#title' => $prompt);
+ $form['keys'] = array('#type' => 'textfield', '#title' => '', '#default_value' => $keys, '#size' => $prompt ? 40 : 30, '#maxlength' => 255);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
+ $form['#attributes'] = array('class' => 'search-form');
return drupal_get_form('search_form', $form);
}
diff --git a/modules/statistics.module b/modules/statistics.module
index fd8c9d7d1..ec5871ddf 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -326,15 +326,15 @@ function statistics_top_referrers() {
function statistics_settings() {
// access log settings:
$options = array('1' => t('Enabled'), '0' => t('Disabled'));
- $form['access'] = array(type => 'fieldset', title => t('Access log settings'));
- $form['access']['statistics_enable_access_log'] = array(type => 'radios', title => t('Enable access log'), default_value => variable_get('statistics_enable_access_log', 0), options => $options, description => t('Log each page access. Required for referrer statistics.'));
+ $form['access'] = array('#type' => 'fieldset', '#title' => t('Access log settings'));
+ $form['access']['statistics_enable_access_log'] = array('#type' => 'radios', '#title' => t('Enable access log'), '#default_value' => variable_get('statistics_enable_access_log', 0), '#options' => $options, '#description' => t('Log each page access. Required for referrer statistics.'));
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
- $form['access']['statistics_flush_accesslog_timer'] = array(type => 'select', title => t('Discard access logs older than'), default_value => variable_get('statistics_flush_accesslog_timer', 259200), options => $period, description => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.'));
+ $form['access']['statistics_flush_accesslog_timer'] = array('#type' => 'select', '#title' => t('Discard access logs older than'), '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200), '#options' => $period, '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.'));
// count content views settings
- $form['content'] = array(type => 'fieldset', title => t('Content viewing counter settings'));
- $form['content']['statistics_count_content_views'] = array(type => 'radios', title => t('Count content views'), default_value => variable_get('statistics_count_content_views', 0), options => $options, description => t('Increment a counter each time content is viewed.'));
- $form['content']['statistics_display_counter'] = array(type => 'radios', title => t('Display counter values'), default_value => variable_get('statistics_display_counter', 0), options => $options, description => t('Display how many times given content has been viewed.'));
+ $form['content'] = array('#type' => 'fieldset', '#title' => t('Content viewing counter settings'));
+ $form['content']['statistics_count_content_views'] = array('#type' => 'radios', '#title' => t('Count content views'), '#default_value' => variable_get('statistics_count_content_views', 0), '#options' => $options, '#description' => t('Increment a counter each time content is viewed.'));
+ $form['content']['statistics_display_counter'] = array('#type' => 'radios', '#title' => t('Display counter values'), '#default_value' => variable_get('statistics_display_counter', 0), '#options' => $options, '#description' => t('Display how many times given content has been viewed.'));
return $form;
}
@@ -413,9 +413,9 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) {
case 'configure':
// Popular content block settings
$numbers = array('0' => t('Disabled')) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
- $form['statistics_block_top_day_num'] = array(type => 'select', title => t("Number of day's top views to display"), default_value => variable_get('statistics_block_top_day_num', 0), options => $numbers, description => t('How many content items to display in "day" list.'));
- $form['statistics_block_top_all_num'] = array(type => 'select', title => t('Number of all time views to display'), default_value => variable_get('statistics_block_top_all_num', 0), options => $numbers, description => t('How many content items to display in "all time" list.'));
- $form['statistics_block_top_last_num'] = array(type => 'select', title => t('Number of most recent views to display'), default_value => variable_get('statistics_block_top_last_num', 0), options => $numbers, description => t('How many content items to display in "recently viewed" list.'));
+ $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get('statistics_block_top_day_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
+ $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get('statistics_block_top_all_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
+ $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get('statistics_block_top_last_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
return $form;
case 'save':
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index fd8c9d7d1..ec5871ddf 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -326,15 +326,15 @@ function statistics_top_referrers() {
function statistics_settings() {
// access log settings:
$options = array('1' => t('Enabled'), '0' => t('Disabled'));
- $form['access'] = array(type => 'fieldset', title => t('Access log settings'));
- $form['access']['statistics_enable_access_log'] = array(type => 'radios', title => t('Enable access log'), default_value => variable_get('statistics_enable_access_log', 0), options => $options, description => t('Log each page access. Required for referrer statistics.'));
+ $form['access'] = array('#type' => 'fieldset', '#title' => t('Access log settings'));
+ $form['access']['statistics_enable_access_log'] = array('#type' => 'radios', '#title' => t('Enable access log'), '#default_value' => variable_get('statistics_enable_access_log', 0), '#options' => $options, '#description' => t('Log each page access. Required for referrer statistics.'));
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
- $form['access']['statistics_flush_accesslog_timer'] = array(type => 'select', title => t('Discard access logs older than'), default_value => variable_get('statistics_flush_accesslog_timer', 259200), options => $period, description => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.'));
+ $form['access']['statistics_flush_accesslog_timer'] = array('#type' => 'select', '#title' => t('Discard access logs older than'), '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200), '#options' => $period, '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.'));
// count content views settings
- $form['content'] = array(type => 'fieldset', title => t('Content viewing counter settings'));
- $form['content']['statistics_count_content_views'] = array(type => 'radios', title => t('Count content views'), default_value => variable_get('statistics_count_content_views', 0), options => $options, description => t('Increment a counter each time content is viewed.'));
- $form['content']['statistics_display_counter'] = array(type => 'radios', title => t('Display counter values'), default_value => variable_get('statistics_display_counter', 0), options => $options, description => t('Display how many times given content has been viewed.'));
+ $form['content'] = array('#type' => 'fieldset', '#title' => t('Content viewing counter settings'));
+ $form['content']['statistics_count_content_views'] = array('#type' => 'radios', '#title' => t('Count content views'), '#default_value' => variable_get('statistics_count_content_views', 0), '#options' => $options, '#description' => t('Increment a counter each time content is viewed.'));
+ $form['content']['statistics_display_counter'] = array('#type' => 'radios', '#title' => t('Display counter values'), '#default_value' => variable_get('statistics_display_counter', 0), '#options' => $options, '#description' => t('Display how many times given content has been viewed.'));
return $form;
}
@@ -413,9 +413,9 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) {
case 'configure':
// Popular content block settings
$numbers = array('0' => t('Disabled')) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
- $form['statistics_block_top_day_num'] = array(type => 'select', title => t("Number of day's top views to display"), default_value => variable_get('statistics_block_top_day_num', 0), options => $numbers, description => t('How many content items to display in "day" list.'));
- $form['statistics_block_top_all_num'] = array(type => 'select', title => t('Number of all time views to display'), default_value => variable_get('statistics_block_top_all_num', 0), options => $numbers, description => t('How many content items to display in "all time" list.'));
- $form['statistics_block_top_last_num'] = array(type => 'select', title => t('Number of most recent views to display'), default_value => variable_get('statistics_block_top_last_num', 0), options => $numbers, description => t('How many content items to display in "recently viewed" list.'));
+ $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get('statistics_block_top_day_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
+ $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get('statistics_block_top_all_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
+ $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get('statistics_block_top_last_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
return $form;
case 'save':
diff --git a/modules/story.module b/modules/story.module
index df70e9fdd..813c50769 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -75,21 +75,17 @@ function story_validate(&$node) {
*/
function story_form(&$node) {
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
-
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('story', $node);
- }
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array(
- type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
$form['log'] = array(
- type => 'textarea', title => t('Log message'), default_value => $node->log, rows => 5,
- description => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#rows' => 5,
+ '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
return $form;
diff --git a/modules/story/story.module b/modules/story/story.module
index df70e9fdd..813c50769 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -75,21 +75,17 @@ function story_validate(&$node) {
*/
function story_form(&$node) {
- $form['title'] = array(type => 'textfield', title => t('Title'), size => 60, maxlength => 128, required => TRUE, default_value => $node->title);
-
- if (function_exists('taxonomy_node_form')) {
- $form['taxonomy'] = taxonomy_node_form('story', $node);
- }
+ $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array(
- type => 'textarea', title => t('Body'), default_value => $node->body, required => TRUE
+ '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#required' => TRUE
);
$form = array_merge($form, filter_form($node->format));
$form['log'] = array(
- type => 'textarea', title => t('Log message'), default_value => $node->log, rows => 5,
- description => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
+ '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#rows' => 5,
+ '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
return $form;
diff --git a/modules/system.module b/modules/system.module
index 874bffbfd..d134a818b 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -54,29 +54,29 @@ function system_perm() {
*/
function system_elements() {
// Top level form
- $type['form'] = array(method => 'POST', action => request_uri());
+ $type['form'] = array('#method' => 'POST', '#action' => request_uri());
// Inputs
- $type['checkbox'] = array(input => TRUE, return_value => 1);
- $type['submit'] = array(input => TRUE, name => 'op', button_type => 'submit', execute => TRUE);
- $type['button'] = array(input => TRUE, name => 'op', button_type => 'submit', exexute => FALSE);
- $type['textfield'] = array(input => TRUE, size => 60, maxlength => 70, autocomplete_path => FALSE);
- $type['password'] = array(input => TRUE, size => 60, maxlength => 70);
- $type['textarea'] = array(input => TRUE, cols => 60, rows => 20);
- $type['radios'] = array(input => TRUE, process => 'expand_radios');
- $type['radio'] = array(input => TRUE);
- $type['checkboxes'] = array(input => TRUE, process => 'expand_checkboxes', tree => TRUE);
- $type['select'] = array(input => TRUE);
- $type['weight'] = array(input => TRUE, delta => 10);
- $type['date'] = array(input => TRUE, process => 'expand_date');
- $type['file'] = array(input => TRUE, size => 60);
+ $type['checkbox'] = array('#input' => TRUE, '#return_value' => 1);
+ $type['submit'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#execute' => TRUE);
+ $type['button'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', exexute => FALSE);
+ $type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 70, '#autocomplete_path' => FALSE);
+ $type['password'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 70);
+ $type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 20);
+ $type['radios'] = array('#input' => TRUE, '#process' => 'expand_radios');
+ $type['radio'] = array('#input' => TRUE);
+ $type['checkboxes'] = array('#input' => TRUE, '#process' => 'expand_checkboxes', '#tree' => TRUE);
+ $type['select'] = array('#input' => TRUE);
+ $type['weight'] = array('#input' => TRUE, '#delta' => 10);
+ $type['date'] = array('#input' => TRUE, '#process' => 'expand_date');
+ $type['file'] = array('#input' => TRUE, '#size' => 60);
// Form structure
$type['item'] = array();
- $type['hidden'] = array(input => TRUE);
- $type['value'] = array(input => TRUE);
- $type['markup'] = array(prefix => '', suffix => '');
- $type['fieldset'] = array(collapsible => FALSE, collapsed => FALSE);
+ $type['hidden'] = array('#input' => TRUE);
+ $type['value'] = array('#input' => TRUE);
+ $type['markup'] = array('#prefix' => '', '#suffix' => '');
+ $type['fieldset'] = array('#collapsible' => FALSE, '#collapsed' => FALSE);
return $type;
}
@@ -170,32 +170,46 @@ function system_user($type, $edit, &$user, $category = NULL) {
}
$form['themes'] = array(
- type => 'fieldset', title => t('Theme configuration'), description => t('Selecting a different theme will change the look and feel of the site.'), weight => 2, collapsible => TRUE, collapsed => FALSE
- );
+ '#type' => 'fieldset', '#title' => t('Theme configuration'), '#description' => t('Selecting a different theme will change the look and feel of the site.'), '#weight' => 2, '#collapsible' => TRUE, '#collapsed' => FALSE, '#theme' => 'system_user');
foreach ($themes as $info) {
$info->screenshot = dirname($info->filename) . '/screenshot.png';
$screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
- $form['themes'][$info->name]['screenshot'] = array(type => 'markup', value => $screenshot);
- $form['themes'][$info->name]['description'] = array(type => 'item', title => $info->name, value => dirname($info->filename));
+ $form['themes'][$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
+ $form['themes'][$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename));
$options[$info->name] = '';
}
- $form['themes']['theme'] = array(type => 'radios', options => $options, default_value => $edit['theme']);
+ $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine'));
if (variable_get('configurable_timezones', 1)) {
$zones = _system_zonelist();
- $form['locale'] = array(type=>'item', title => t('Locale settings'), weight => 6);
+ $form['locale'] = array('#type'=>'item', '#title' => t('Locale settings'), '#weight' => 6);
$form['locale']['timezone'] = array(
- type => 'select', title => t('Time zone'), default_value => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
- options => $zones, descriptions => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
+ '#type' => 'select', '#title' => t('Time zone'), '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
+ '#options' => $zones, descriptions => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
);
}
return $form;
}
}
+function theme_system_user($form) {
+ foreach (element_children($form) as $key) {
+ $row = array();
+ if (is_array($form[$key]['description'])) {
+ $row[] = form_render($form[$key]['screenshot']);
+ $row[] = form_render($form[$key]['description']);
+ $row[] = form_render($form['theme'][$key]);
+ }
+ $rows[] = $row;
+ }
+
+ $output = theme('table', $header, $rows);
+ return $output;
+}
+
function _system_zonelist() {
$timestamp = time();
$zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
@@ -210,117 +224,117 @@ function _system_zonelist() {
function system_view_general() {
// General settings:
$form['general'] = array(
- type => 'fieldset', title => t('General settings'),
- collapsible => TRUE, collapsed => TRUE
+ '#type' => 'fieldset', '#title' => t('General settings'),
+ '#collapsible' => TRUE, '#collapsed' => TRUE
);
$form['general']['site_name'] = array(
- type => 'textfield', title => t('Name'), default_value => variable_get('site_name', 'drupal'),
- description => t('The name of this web site.')
+ '#type' => 'textfield', '#title' => t('Name'), '#default_value' => variable_get('site_name', 'drupal'),
+ '#description' => t('The name of this web site.')
);
$form['general']['site_mail'] = array(
- type => 'textfield', title => t('E-mail address'), default_value => variable_get('site_mail', ini_get('sendmail_from')), maxlength => 128,
- description => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.')
+ '#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), '#maxlength' => 128,
+ '#description' => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.')
);
$form['general']['site_slogan'] = array(
- type => 'textfield', title => t('Slogan'), default_value => variable_get('site_slogan', ''),
- maxlength => 128, description => t('The slogan of this website. Some themes display a slogan when available.')
+ '#type' => 'textfield', '#title' => t('Slogan'), '#default_value' => variable_get('site_slogan', ''),
+ '#maxlength' => 128, '#description' => t('The slogan of this website. Some themes display a slogan when available.')
);
$form['general']['site_mission'] = array(
- type => 'textarea', title => t('Mission'), default_value => variable_get('site_mission', ''),
- rows => 5, description => t('Your site\'s mission statement or focus.')
+ '#type' => 'textarea', '#title' => t('Mission'), '#default_value' => variable_get('site_mission', ''),
+ '#rows' => 5, '#description' => t('Your site\'s mission statement or focus.')
);
$form['general']['site_footer'] = array(
- type => 'textarea', title => t('Footer message'), default_value => variable_get('site_footer', ''), rows => 5,
- description => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.')
+ '#type' => 'textarea', '#title' => t('Footer message'), '#default_value' => variable_get('site_footer', ''), '#rows' => 5,
+ '#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.')
);
$form['general']['anonymous'] = array(
- type => 'textfield', title => t('Anonymous user'), default_value => variable_get('anonymous', 'Anonymous'),
- description => t('The name used to indicate anonymous users.')
+ '#type' => 'textfield', '#title' => t('Anonymous user'), '#default_value' => variable_get('anonymous', 'Anonymous'),
+ '#description' => t('The name used to indicate anonymous users.')
);
$form['general']['site_frontpage'] = array(
- type => 'textfield', title => t('Default front page'), default_value => variable_get('site_frontpage', 'node'),
- description => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".')
+ '#type' => 'textfield', '#title' => t('Default front page'), '#default_value' => variable_get('site_frontpage', 'node'),
+ '#description' => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".')
);
// We check for clean URL support using an image on the client side.
$form['general']['clean_url'] = array(
- type => 'radios', title => t('Clean URLs'), default_value => variable_get('clean_url', 0), options => array(t('Disabled'), t('Enabled')),
- description => t('This option makes Drupal emit clean URLs (i.e. without <code>?q=</code> in the URL). You\'ll need <code>ModRewrite</code> support for this to work. See the <code>.htaccess</code> file in Drupal\'s top-level directory for more information.')
+ '#type' => 'radios', '#title' => t('Clean URLs'), '#default_value' => variable_get('clean_url', 0), '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t('This option makes Drupal emit clean URLs (i.e. without <code>?q=</code> in the URL). You\'ll need <code>ModRewrite</code> support for this to work. See the <code>.htaccess</code> file in Drupal\'s top-level directory for more information.')
);
variable_set('clean_url_ok', 0);
global $base_url;
// We will use a random URL so there is no way a proxy or a browser could cache the "no such image" answer.
- $form['general']['clean_url_test'] = array(type => 'markup', value => '<img style="position: relative; left: -1000em;" src="'. $base_url. '/system/test/'. user_password(20) .'.png" alt="" />');
+ $form['general']['clean_url_test'] = array('#type' => 'markup', '#value' => '<img style="position: relative; left: -1000em;" src="'. $base_url. '/system/test/'. user_password(20) .'.png" alt="" />');
// Error handling:
- $form['errors'] = array( type => 'fieldset', title =>t('Error handling'), collapsible => TRUE, collapsed => TRUE );
+ $form['errors'] = array( '#type' => 'fieldset', '#title' =>t('Error handling'), '#collapsible' => TRUE, '#collapsed' => TRUE );
$form['errors']['site_403'] = array(
- type => 'textfield', title => t('Default 403 (access denied) page'), default_value => variable_get('site_403', ''),
- description => t('This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
+ '#type' => 'textfield', '#title' => t('Default 403 (access denied) page'), '#default_value' => variable_get('site_403', ''),
+ '#description' => t('This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
);
$form['errors']['site_404'] = array(
- type => 'textfield', title => t('Default 404 (not found) page'), default_value => variable_get('site_404', ''),
- description => t('This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
+ '#type' => 'textfield', '#title' => t('Default 404 (not found) page'), '#default_value' => variable_get('site_404', ''),
+ '#description' => t('This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
);
$form['errors']['error_level'] = array(
- type => 'select', title => t('Error reporting'), default_value => variable_get('error_level', 1),
- options => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
- description => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
+ '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1),
+ '#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
+ '#description' => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
);
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
$period['1000000000'] = t('Never');
$form['errors']['watchdog_clear'] = array(
- type => 'select', title => t('Discard log entries older than'), default_value => variable_get('watchdog_clear', 604800), options => $period,
- description => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')
+ '#type' => 'select', '#title' => t('Discard log entries older than'), '#default_value' => variable_get('watchdog_clear', 604800), '#options' => $period,
+ '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')
);
// Caching:
- $form['cache'] = array(type => 'fieldset', title => t('Cache settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['cache'] = array('#type' => 'fieldset', '#title' => t('Cache settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cache']['cache'] = array(
- type => 'radios', title => t('Page cache'), default_value => variable_get('cache', CACHE_DISABLED),
- options => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')),
- description => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.")
+ '#type' => 'radios', '#title' => t('Page cache'), '#default_value' => variable_get('cache', CACHE_DISABLED),
+ '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')),
+ '#description' => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.")
);
$period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
$period[0] = t('none');
$form['cache']['cache_lifetime'] = array(
- type => 'select', title => t('Minimum cache lifetime'), default_value => variable_get('cache_lifetime', 0), options => $period,
- description => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites. On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
+ '#type' => 'select', '#title' => t('Minimum cache lifetime'), '#default_value' => variable_get('cache_lifetime', 0), '#options' => $period,
+ '#description' => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites. On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
);
// File system:
- $form['files'] = array(type => 'fieldset', title => t('File system settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['files'] = array('#type' => 'fieldset', '#title' => t('File system settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$directory_path = variable_get('file_directory_path', 'files');
file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
$form['files']['file_directory_path'] = array(
- type => 'textfield', title => t('File system path'), default_value => $directory_path, maxlength => 255, valid => 'directory',
- description => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')
+ '#type' => 'textfield', '#title' => t('File system path'), '#default_value' => $directory_path, '#maxlength' => 255, '#valid' => 'directory',
+ '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')
);
$directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP);
file_check_directory($directory_temp, FILE_CREATE_DIRECTORY, 'file_directory_temp');
$form['files']['file_directory_tmp'] = array(
- type => 'textfield', title => t('Temporary directory'), default_value => $directory_temp, maxlength => 255, valid => 'directory',
- description => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')
+ '#type' => 'textfield', '#title' => t('Temporary directory'), '#default_value' => $directory_temp, '#maxlength' => 255, '#valid' => 'directory',
+ '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')
);
$form['files']['file_downloads'] = array(
- type => 'radios', title => t('Download method'), default_value => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
- options => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
- description => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')
+ '#type' => 'radios', '#title' => t('Download method'), '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
+ '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
+ '#description' => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')
);
/*
@@ -329,28 +343,28 @@ function system_view_general() {
$toolkits_available = image_get_available_toolkits();
if (count($toolkits_available) > 1) {
$group['image_toolkit'] = array(
- type => 'radios', title => t('Select an image processing toolkit'),
- default_value => variable_get('image_toolkit', image_get_toolkit()), options => $toolkits_available
+ '#type' => 'radios', '#title' => t('Select an image processing toolkit'),
+ '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available
);
}
$group['toolkit'] = image_toolkit_invoke('settings');
if (is_array($group)) {
- $form['image'] = array(type => 'fieldset', title => t('Image handling'), collapsible => TRUE, collapsed => true);
+ $form['image'] = array('#type' => 'fieldset', '#title' => t('Image handling'), '#collapsible' => TRUE, '#collapsed' => true);
$form['image'] = array_merge($form['image'], $group);
}
*/
// Feed settings
- $form['feed'] = array(type => 'fieldset', title => t('RSS feed settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['feed'] = array('#type' => 'fieldset', '#title' => t('RSS feed settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['feed']['feed_default_items'] = array(
- type => 'select', title => t('Number of items per feed'), default_value => variable_get('feed_default_items', 10),
- options => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
- description => t('The default number of items to include in a feed.')
+ '#type' => 'select', '#title' => t('Number of items per feed'), '#default_value' => variable_get('feed_default_items', 10),
+ '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
+ '#description' => t('The default number of items to include in a feed.')
);
$form['feed']['feed_item_length'] = array(
- type => 'select', title => t('Display of XML feed items'), default_value => variable_get('feed_item_length','teaser'),
- options => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
- description => t('Global setting for the length of XML feed items that are output by default.')
+ '#type' => 'select', '#title' => t('Display of XML feed items'), '#default_value' => variable_get('feed_item_length','teaser'),
+ '#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
+ '#description' => t('Global setting for the length of XML feed items that are output by default.')
);
// Date settings:
@@ -379,64 +393,64 @@ function system_view_general() {
$datelongchoices[$f] = format_date(time(), 'custom', $f);
}
- $form['dates'] = array(type => 'fieldset', title => t('Date settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['dates'] = array('#type' => 'fieldset', '#title' => t('Date settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['dates']['date_default_timezone'] = array(
- type => 'select', title => t('Default time zone'), default_value => variable_get('date_default_timezone', 0),
- options => $zones, description => t('Select the default site time zone.')
+ '#type' => 'select', '#title' => t('Default time zone'), '#default_value' => variable_get('date_default_timezone', 0),
+ '#options' => $zones, '#description' => t('Select the default site time zone.')
);
$form['dates']['configurable_timezones'] = array(
- type => 'radios', title => t('Configurable time zones'), default_value => variable_get('configurable_timezones', 1), options => array(t('Disabled'), t('Enabled')),
- description => t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.')
+ '#type' => 'radios', '#title' => t('Configurable time zones'), '#default_value' => variable_get('configurable_timezones', 1), '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.')
);
$form['dates']['date_format_short'] = array(
- type => 'select', title => t('Short date format'), default_value => variable_get('date_format_short', $dateshort[0]),
- options => $dateshortchoices, description => t('The short format of date display.')
+ '#type' => 'select', '#title' => t('Short date format'), '#default_value' => variable_get('date_format_short', $dateshort[0]),
+ '#options' => $dateshortchoices, '#description' => t('The short format of date display.')
);
$form['dates']['date_format_medium'] = array(
- type => 'select', title => t('Medium date format'), default_value => variable_get('date_format_medium', $datemedium[0]),
- options => $datemediumchoices, description => t('The medium sized date display.')
+ '#type' => 'select', '#title' => t('Medium date format'), '#default_value' => variable_get('date_format_medium', $datemedium[0]),
+ '#options' => $datemediumchoices, '#description' => t('The medium sized date display.')
);
$form['dates']['date_format_long'] = array(
- type => 'select', title => t('Long date format'), default_value => variable_get('date_format_long', $datelong[0]),
- options => $datelongchoices, description => t('Longer date format used for detailed display.')
+ '#type' => 'select', '#title' => t('Long date format'), '#default_value' => variable_get('date_format_long', $datelong[0]),
+ '#options' => $datelongchoices, '#description' => t('Longer date format used for detailed display.')
);
$form['dates']['date_first_day'] = array(
- type => 'select', title => t('First day of week'), default_value => variable_get('date_first_day', 0),
- options => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
- description => t('The first day of the week for calendar views.')
+ '#type' => 'select', '#title' => t('First day of week'), '#default_value' => variable_get('date_first_day', 0),
+ '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
+ '#description' => t('The first day of the week for calendar views.')
);
// Site offline/maintenance settings
$form['site_status'] = array(
- type => 'fieldset',
- title => t('Site maintenance'),
- collapsible => TRUE,
- collapsed => TRUE);
+ '#type' => 'fieldset',
+ '#title' => t('Site maintenance'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE);
$form['site_status']['site_offline'] = array(
- type => 'radios',
- title => t('Site status'),
- default_value => variable_get('site_offline', 0),
- options => array(t('Online'), t('Offline')),
- description => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Offline", only users with the "administer site configuration" permission will be able to access your site to perform maintenance, all other visitors will see the site offline message configured below.')
+ '#type' => 'radios',
+ '#title' => t('Site status'),
+ '#default_value' => variable_get('site_offline', 0),
+ '#options' => array(t('Online'), t('Offline')),
+ '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Offline", only users with the "administer site configuration" permission will be able to access your site to perform maintenance, all other visitors will see the site offline message configured below.')
);
$form['site_status']['site_offline_message'] = array(
- type => 'textarea',
- rows => 5,
- title => t('Site offline message'),
- default_value => variable_get('site_offline_message', t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This drupal site'))))),
- description => t('Message to show visitors when site is offline.')
+ '#type' => 'textarea',
+ '#rows' => 5,
+ '#title' => t('Site offline message'),
+ '#default_value' => variable_get('site_offline_message', t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This drupal site'))))),
+ '#description' => t('Message to show visitors when site is offline.')
);
// String handling: report status and errors.
- $form['strings'] = array(type => 'fieldset', title => t('String handling'), collapsible => TRUE, collapsed => TRUE);
+ $form['strings'] = array('#type' => 'fieldset', '#title' => t('String handling'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['strings'] = array_merge($form['strings'], unicode_settings());
return $form;
@@ -657,8 +671,8 @@ function system_initialize_theme_blocks($theme) {
// Add the submit / reset buttons and run drupal_get_form()
function system_settings_form($form_id, $form) {
- $form['buttons']['submit'] = array(type => 'submit', value => t('Save configuration') );
- $form['buttons']['reset'] = array(type => 'submit', value => t('Reset to defaults') );
+ $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
+ $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
if (!empty($_POST) && form_get_errors()) {
drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');
@@ -719,14 +733,14 @@ function system_themes() {
$info->screenshot = dirname($info->filename) . '/screenshot.png';
$screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
- $form[$info->name]['screenshot'] = array(type => 'markup', value => $screenshot);
- $form[$info->name]['description'] = array(type => 'item', title => $info->name, value => dirname($info->filename));
+ $form[$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
+ $form[$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename));
$options[$info->name] = '';
if ($info->status) {
$status[] = $info->name;
}
if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
- $form[$info->name]['operations'] = array(type => 'markup', value => l(t('configure'), 'admin/themes/settings/' . $info->name) );
+ $form[$info->name]['operations'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/themes/settings/' . $info->name) );
}
else {
// Dummy element for form_render. Cleaner than adding a check in the theme function.
@@ -734,10 +748,10 @@ function system_themes() {
}
}
- $form['status'] = array(type => 'checkboxes', options => $options, default_value => $status);
- $form['theme_default'] = array(type => 'radios', options => $options, default_value => variable_get('theme_default', 'bluemarine'));
- $form['buttons']['submit'] = array(type => 'submit', value => t('Save configuration') );
- $form['buttons']['reset'] = array(type => 'submit', value => t('Reset to defaults') );
+ $form['status'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status);
+ $form['theme_default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('theme_default', 'bluemarine'));
+ $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
+ $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
return drupal_get_form('system_themes', $form);
}
@@ -804,8 +818,8 @@ function system_modules() {
$file->description = module_invoke($file->name, 'help', 'admin/modules#description');
- $form['name'][$file->name] = array(value => $file->name);
- $form['description'][$file->name] = array(value => $file->description);
+ $form['name'][$file->name] = array('#value' => $file->name);
+ $form['description'][$file->name] = array('#value' => $file->description);
$options[$file->name] = '';
if ($file->status) {
$status[] = $file->name;
@@ -831,24 +845,24 @@ function system_modules() {
// Handle status checkboxes, including overriding the generated
// checkboxes for required modules.
- $form['status'] = array(type => 'checkboxes', default_value => $status, options => $options, tree => TRUE);
+ $form['status'] = array('#type' => 'checkboxes', '#default_value' => $status, '#options' => $options, '#tree' => TRUE);
$required = array('block', 'filter', 'system', 'user', 'watchdog');
foreach ($required as $require) {
- $form['status'][$require] = array(type => 'hidden', value => 1, suffix => t('required'));
+ $form['status'][$require] = array('#type' => 'hidden', '#value' => 1, '#suffix' => t('required'));
}
/**
* Handle throttle checkboxes, including overriding the generated checkboxes for required modules.
*/
if (module_exist('throttle')) {
- $form['throttle'] = array(type => 'checkboxes', default_value => $throttle, options => $options, tree => TRUE);
+ $form['throttle'] = array('#type' => 'checkboxes', '#default_value' => $throttle, '#options' => $options, '#tree' => TRUE);
$throttle_required = array_merge($required, array('throttle'));
foreach ($throttle_required as $require) {
- $form['throttle'][$require] = array(type => 'hidden', value => 1, suffix => t('required'));
+ $form['throttle'][$require] = array('#type' => 'hidden', '#value' => 1, '#suffix' => t('required'));
}
}
- $form['buttons']['submit'] = array(type => 'submit', value => t('Save configuration'));
+ $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('system_modules', $form);
}
@@ -935,7 +949,7 @@ function system_theme_settings($key = '') {
$var = 'theme_settings';
}
- $form['var'] = array(type => 'hidden', value => $var);
+ $form['var'] = array('#type' => 'hidden', '#value' => $var);
// Check for a new uploaded logo, and use that instead.
if ($file = file_check_upload('logo_upload')) {
@@ -967,36 +981,36 @@ function system_theme_settings($key = '') {
// Logo settings
if ((!$key) || in_array('logo', $features)) {
- $form['logo'] = array(type => 'fieldset', title => t('Logo image settings'));
+ $form['logo'] = array('#type' => 'fieldset', '#title' => t('Logo image settings'));
$form['logo']["default_logo"] = array(
- type => 'checkbox', title => t('Use the default logo'), default_value => $settings['default_logo'], tree => FALSE,
- description => t('Check here if you want the theme to use the logo supplied with it.')
+ '#type' => 'checkbox', '#title' => t('Use the default logo'), '#default_value' => $settings['default_logo'], '#tree' => FALSE,
+ '#description' => t('Check here if you want the theme to use the logo supplied with it.')
);
$form['logo']['logo_path'] = array(
- type => 'textfield', title => t('Path to custom logo'), size => 60, maxlength => 128,
- description => t('The path to the file you would like to use as your logo file instead of the default logo.'));
+ '#type' => 'textfield', '#title' => t('Path to custom logo'), '#size' => 60, '#maxlength' => 128,
+ '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'));
$form['logo']['logo_upload'] = array(
- type => 'file', title => t('Upload logo image'), maxlength => 40,
- description => t("If you don't have direct file access to the server, use this field to upload your logo.")
+ '#type' => 'file', '#title' => t('Upload logo image'), '#maxlength' => 40,
+ '#description' => t("If you don't have direct file access to the server, use this field to upload your logo.")
);
}
// Icon settings
if ((!$key) || in_array('toggle_favicon', $features)) {
- $form['favicon'] = array(type => 'fieldset', title => t('Shortcut icon settings'));
- $form['favicon']['text'] = array(value => t('Your shortcut icon or \'favicon\' is displayed in the address bar and bookmarks of most browsers.'));
+ $form['favicon'] = array('#type' => 'fieldset', '#title' => t('Shortcut icon settings'));
+ $form['favicon']['text'] = array('#value' => t('Your shortcut icon or \'favicon\' is displayed in the address bar and bookmarks of most browsers.'));
$form['favicon']['default_favicon'] = array(
- type => 'checkbox', title => t('Use the default shortcut icon.'), default_value => $settings['default_favicon'],
- description => t('Check here if you want the theme to use the default shortcut icon.')
+ '#type' => 'checkbox', '#title' => t('Use the default shortcut icon.'), '#default_value' => $settings['default_favicon'],
+ '#description' => t('Check here if you want the theme to use the default shortcut icon.')
);
$form['favicon']['favicon_path'] = array(
- type => 'textfield', title => t('Path to custom icon'), default_value => $settings['favicon_path'],
- description => t('The path to the image file you would like to use as your custom shortcut icon.')
+ '#type' => 'textfield', '#title' => t('Path to custom icon'), '#default_value' => $settings['favicon_path'],
+ '#description' => t('The path to the image file you would like to use as your custom shortcut icon.')
);
$form['favicon']['favicon_upload'] = array(
- type => 'file', title => t('Upload icon image'), description => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.")
+ '#type' => 'file', '#title' => t('Upload icon image'), '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.")
);
}
@@ -1011,9 +1025,9 @@ function system_theme_settings($key = '') {
$node_types = module_invoke('node', 'get_types');
if ($node_types) {
$group = '';
- $form['node_info'] = array(type => 'fieldset', title => t('Display post information on'), description => t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type'));
+ $form['node_info'] = array('#type' => 'fieldset', '#title' => t('Display post information on'), '#description' => t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type'));
foreach ($node_types as $type => $name) {
- $form['node_info']["toggle_node_info_$type"] = array(type => 'checkbox', title => $name, default_value => $settings["toggle_node_info_$type"]);
+ $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
}
}
}
@@ -1043,11 +1057,11 @@ function system_theme_settings($key = '') {
$disabled['toggle_search'] = true;
}
- $form['toggles'] = array(type => 'fieldset', title => t('Toggle display'), description => t('Enable or disable the display of certain page elements.'));
+ $form['toggles'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'));
foreach ($toggles as $name => $title) {
if ((!$key) || in_array($name, $features)) {
// disable search box if search.module is disabled
- $form['toggles'][$name] = array(type => 'checkbox', title => $title, default_value => $settings[$name], attributes => isset($disabled[$name]) ? array('disabled' => 'disabled') : NULL);
+ $form['toggles'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name], '#attributes' => isset($disabled[$name]) ? array('disabled' => 'disabled') : NULL);
}
}
@@ -1057,17 +1071,17 @@ function system_theme_settings($key = '') {
if (function_exists($function)) {
if ($themes[$key]->template) {
// file is a template or a style of a template
- $form['specific'] = array(type => 'fieldset', title => t('Engine-specific settings'), description => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix)));
+ $form['specific'] = array('#type' => 'fieldset', '#title' => t('Engine-specific settings'), '#description' => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix)));
}
else {
// file is a theme or a style of a theme
- $form['specific'] = array(type => 'fieldset', title => t('Theme-specific settings'), description => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => $themes[$key]->prefix)));
+ $form['specific'] = array('#type' => 'fieldset', '#title' => t('Theme-specific settings'), '#description' => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => $themes[$key]->prefix)));
}
$group = $function();
$form['specific'] = array_merge($form['specific'], (is_array($group) ? $group : array()));
}
}
- $form[attributes] = array('enctype' => 'multipart/form-data');
+ $form['#attributes'] = array('enctype' => 'multipart/form-data');
return system_settings_form('system_theme_settings', $form);
@@ -1094,21 +1108,21 @@ function system_navigation_links_form($type, $utype) {
variable_set($type . '_link_count', $count);
}
$form = array(
- type => 'item', title => t('_TYPE_ link settings', array('_TYPE_' => $utype)), theme => 'system_navigation_links_form',
- description => t('You can specify your _TYPE_ links here, one link per line.<br /> The link text field is the text you want to link.<br /> The url field is the location the link points to.<br /> The description field is an optional description of where the link points.', array('_TYPE_' => $type))
+ '#type' => 'item', '#title' => t('_TYPE_ link settings', array('_TYPE_' => $utype)), '#theme' => 'system_navigation_links_form',
+ '#description' => t('You can specify your _TYPE_ links here, one link per line.<br /> The link text field is the text you want to link.<br /> The url field is the location the link points to.<br /> The description field is an optional description of where the link points.', array('_TYPE_' => $type))
);
- $form[tree] = TRUE;
+ $form['#tree'] = TRUE;
for ($i = 0; $i < $count; $i++) {
foreach (array('text', 'link', 'description') as $field) {
- $form[$field][$i] = array(type => 'textfield', default_value => $value[$field][$i], size => 15, maxlength => 90);
+ $form[$field][$i] = array('#type' => 'textfield', '#default_value' => $value[$field][$i], '#size' => 15, '#maxlength' => 90);
}
}
$form[$type . '_links_more'] = array(
- type => 'checkbox', title => t('I need more _TYPE_ links.', array('_TYPE_' => $type)), default_value => FALSE,
- description => t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type))
+ '#type' => 'checkbox', '#title' => t('I need more _TYPE_ links.', array('_TYPE_' => $type)), '#default_value' => FALSE,
+ '#description' => t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type))
);
return $form;
}
@@ -1130,9 +1144,9 @@ function theme_system_navigation_links_form(&$form) {
function search_box() {
- $form[action] = url('search');
- $form['keys'] = array(type => 'textfield', size=> 15, value => '', attributes => array('alt' => t('Enter the terms you wish to search for.'), 'class' => 'form-text'));
- $form['submit'] = array(type => 'submit', value => t('search'));
+ $form['#action'] = url('search');
+ $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.'), 'class' => 'form-text'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('search'));
return drupal_get_form('search_box', $form);
}
@@ -1179,12 +1193,12 @@ function confirm_form($form_id, $form, $question, $path, $description = NULL, $y
$description = ($description) ? $description : t('This action cannot be undone.');
drupal_set_title($question);
- $form[attributes] = array('class' => 'confirmation');
- $form['description'] = array(value => $description);
- $form[$name] = array(type => 'hidden', value => 1);
+ $form['#attributes'] = array('class' => 'confirmation');
+ $form['description'] = array('#value' => $description);
+ $form[$name] = array('#type' => 'hidden', '#value' => 1);
- $form['actions'] = array(prefix => '<div class="container-inline">', suffix => '</div>');
- $form['actions']['submit'] = array(type => 'submit', value => $yes ? $yes : t('Confirm'));
- $form['actions']['cancel'] = array(value => l($no ? $no : t('Cancel'), $path));
+ $form['actions'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
+ $form['actions']['submit'] = array('#type' => 'submit', '#value' => $yes ? $yes : t('Confirm'));
+ $form['actions']['cancel'] = array('#value' => l($no ? $no : t('Cancel'), $path));
return drupal_get_form($form_id, $form, 'confirm_form');
}
diff --git a/modules/system/system.module b/modules/system/system.module
index 874bffbfd..d134a818b 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -54,29 +54,29 @@ function system_perm() {
*/
function system_elements() {
// Top level form
- $type['form'] = array(method => 'POST', action => request_uri());
+ $type['form'] = array('#method' => 'POST', '#action' => request_uri());
// Inputs
- $type['checkbox'] = array(input => TRUE, return_value => 1);
- $type['submit'] = array(input => TRUE, name => 'op', button_type => 'submit', execute => TRUE);
- $type['button'] = array(input => TRUE, name => 'op', button_type => 'submit', exexute => FALSE);
- $type['textfield'] = array(input => TRUE, size => 60, maxlength => 70, autocomplete_path => FALSE);
- $type['password'] = array(input => TRUE, size => 60, maxlength => 70);
- $type['textarea'] = array(input => TRUE, cols => 60, rows => 20);
- $type['radios'] = array(input => TRUE, process => 'expand_radios');
- $type['radio'] = array(input => TRUE);
- $type['checkboxes'] = array(input => TRUE, process => 'expand_checkboxes', tree => TRUE);
- $type['select'] = array(input => TRUE);
- $type['weight'] = array(input => TRUE, delta => 10);
- $type['date'] = array(input => TRUE, process => 'expand_date');
- $type['file'] = array(input => TRUE, size => 60);
+ $type['checkbox'] = array('#input' => TRUE, '#return_value' => 1);
+ $type['submit'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#execute' => TRUE);
+ $type['button'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', exexute => FALSE);
+ $type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 70, '#autocomplete_path' => FALSE);
+ $type['password'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 70);
+ $type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 20);
+ $type['radios'] = array('#input' => TRUE, '#process' => 'expand_radios');
+ $type['radio'] = array('#input' => TRUE);
+ $type['checkboxes'] = array('#input' => TRUE, '#process' => 'expand_checkboxes', '#tree' => TRUE);
+ $type['select'] = array('#input' => TRUE);
+ $type['weight'] = array('#input' => TRUE, '#delta' => 10);
+ $type['date'] = array('#input' => TRUE, '#process' => 'expand_date');
+ $type['file'] = array('#input' => TRUE, '#size' => 60);
// Form structure
$type['item'] = array();
- $type['hidden'] = array(input => TRUE);
- $type['value'] = array(input => TRUE);
- $type['markup'] = array(prefix => '', suffix => '');
- $type['fieldset'] = array(collapsible => FALSE, collapsed => FALSE);
+ $type['hidden'] = array('#input' => TRUE);
+ $type['value'] = array('#input' => TRUE);
+ $type['markup'] = array('#prefix' => '', '#suffix' => '');
+ $type['fieldset'] = array('#collapsible' => FALSE, '#collapsed' => FALSE);
return $type;
}
@@ -170,32 +170,46 @@ function system_user($type, $edit, &$user, $category = NULL) {
}
$form['themes'] = array(
- type => 'fieldset', title => t('Theme configuration'), description => t('Selecting a different theme will change the look and feel of the site.'), weight => 2, collapsible => TRUE, collapsed => FALSE
- );
+ '#type' => 'fieldset', '#title' => t('Theme configuration'), '#description' => t('Selecting a different theme will change the look and feel of the site.'), '#weight' => 2, '#collapsible' => TRUE, '#collapsed' => FALSE, '#theme' => 'system_user');
foreach ($themes as $info) {
$info->screenshot = dirname($info->filename) . '/screenshot.png';
$screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
- $form['themes'][$info->name]['screenshot'] = array(type => 'markup', value => $screenshot);
- $form['themes'][$info->name]['description'] = array(type => 'item', title => $info->name, value => dirname($info->filename));
+ $form['themes'][$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
+ $form['themes'][$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename));
$options[$info->name] = '';
}
- $form['themes']['theme'] = array(type => 'radios', options => $options, default_value => $edit['theme']);
+ $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine'));
if (variable_get('configurable_timezones', 1)) {
$zones = _system_zonelist();
- $form['locale'] = array(type=>'item', title => t('Locale settings'), weight => 6);
+ $form['locale'] = array('#type'=>'item', '#title' => t('Locale settings'), '#weight' => 6);
$form['locale']['timezone'] = array(
- type => 'select', title => t('Time zone'), default_value => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
- options => $zones, descriptions => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
+ '#type' => 'select', '#title' => t('Time zone'), '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
+ '#options' => $zones, descriptions => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
);
}
return $form;
}
}
+function theme_system_user($form) {
+ foreach (element_children($form) as $key) {
+ $row = array();
+ if (is_array($form[$key]['description'])) {
+ $row[] = form_render($form[$key]['screenshot']);
+ $row[] = form_render($form[$key]['description']);
+ $row[] = form_render($form['theme'][$key]);
+ }
+ $rows[] = $row;
+ }
+
+ $output = theme('table', $header, $rows);
+ return $output;
+}
+
function _system_zonelist() {
$timestamp = time();
$zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
@@ -210,117 +224,117 @@ function _system_zonelist() {
function system_view_general() {
// General settings:
$form['general'] = array(
- type => 'fieldset', title => t('General settings'),
- collapsible => TRUE, collapsed => TRUE
+ '#type' => 'fieldset', '#title' => t('General settings'),
+ '#collapsible' => TRUE, '#collapsed' => TRUE
);
$form['general']['site_name'] = array(
- type => 'textfield', title => t('Name'), default_value => variable_get('site_name', 'drupal'),
- description => t('The name of this web site.')
+ '#type' => 'textfield', '#title' => t('Name'), '#default_value' => variable_get('site_name', 'drupal'),
+ '#description' => t('The name of this web site.')
);
$form['general']['site_mail'] = array(
- type => 'textfield', title => t('E-mail address'), default_value => variable_get('site_mail', ini_get('sendmail_from')), maxlength => 128,
- description => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.')
+ '#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), '#maxlength' => 128,
+ '#description' => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.')
);
$form['general']['site_slogan'] = array(
- type => 'textfield', title => t('Slogan'), default_value => variable_get('site_slogan', ''),
- maxlength => 128, description => t('The slogan of this website. Some themes display a slogan when available.')
+ '#type' => 'textfield', '#title' => t('Slogan'), '#default_value' => variable_get('site_slogan', ''),
+ '#maxlength' => 128, '#description' => t('The slogan of this website. Some themes display a slogan when available.')
);
$form['general']['site_mission'] = array(
- type => 'textarea', title => t('Mission'), default_value => variable_get('site_mission', ''),
- rows => 5, description => t('Your site\'s mission statement or focus.')
+ '#type' => 'textarea', '#title' => t('Mission'), '#default_value' => variable_get('site_mission', ''),
+ '#rows' => 5, '#description' => t('Your site\'s mission statement or focus.')
);
$form['general']['site_footer'] = array(
- type => 'textarea', title => t('Footer message'), default_value => variable_get('site_footer', ''), rows => 5,
- description => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.')
+ '#type' => 'textarea', '#title' => t('Footer message'), '#default_value' => variable_get('site_footer', ''), '#rows' => 5,
+ '#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.')
);
$form['general']['anonymous'] = array(
- type => 'textfield', title => t('Anonymous user'), default_value => variable_get('anonymous', 'Anonymous'),
- description => t('The name used to indicate anonymous users.')
+ '#type' => 'textfield', '#title' => t('Anonymous user'), '#default_value' => variable_get('anonymous', 'Anonymous'),
+ '#description' => t('The name used to indicate anonymous users.')
);
$form['general']['site_frontpage'] = array(
- type => 'textfield', title => t('Default front page'), default_value => variable_get('site_frontpage', 'node'),
- description => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".')
+ '#type' => 'textfield', '#title' => t('Default front page'), '#default_value' => variable_get('site_frontpage', 'node'),
+ '#description' => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".')
);
// We check for clean URL support using an image on the client side.
$form['general']['clean_url'] = array(
- type => 'radios', title => t('Clean URLs'), default_value => variable_get('clean_url', 0), options => array(t('Disabled'), t('Enabled')),
- description => t('This option makes Drupal emit clean URLs (i.e. without <code>?q=</code> in the URL). You\'ll need <code>ModRewrite</code> support for this to work. See the <code>.htaccess</code> file in Drupal\'s top-level directory for more information.')
+ '#type' => 'radios', '#title' => t('Clean URLs'), '#default_value' => variable_get('clean_url', 0), '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t('This option makes Drupal emit clean URLs (i.e. without <code>?q=</code> in the URL). You\'ll need <code>ModRewrite</code> support for this to work. See the <code>.htaccess</code> file in Drupal\'s top-level directory for more information.')
);
variable_set('clean_url_ok', 0);
global $base_url;
// We will use a random URL so there is no way a proxy or a browser could cache the "no such image" answer.
- $form['general']['clean_url_test'] = array(type => 'markup', value => '<img style="position: relative; left: -1000em;" src="'. $base_url. '/system/test/'. user_password(20) .'.png" alt="" />');
+ $form['general']['clean_url_test'] = array('#type' => 'markup', '#value' => '<img style="position: relative; left: -1000em;" src="'. $base_url. '/system/test/'. user_password(20) .'.png" alt="" />');
// Error handling:
- $form['errors'] = array( type => 'fieldset', title =>t('Error handling'), collapsible => TRUE, collapsed => TRUE );
+ $form['errors'] = array( '#type' => 'fieldset', '#title' =>t('Error handling'), '#collapsible' => TRUE, '#collapsed' => TRUE );
$form['errors']['site_403'] = array(
- type => 'textfield', title => t('Default 403 (access denied) page'), default_value => variable_get('site_403', ''),
- description => t('This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
+ '#type' => 'textfield', '#title' => t('Default 403 (access denied) page'), '#default_value' => variable_get('site_403', ''),
+ '#description' => t('This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
);
$form['errors']['site_404'] = array(
- type => 'textfield', title => t('Default 404 (not found) page'), default_value => variable_get('site_404', ''),
- description => t('This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
+ '#type' => 'textfield', '#title' => t('Default 404 (not found) page'), '#default_value' => variable_get('site_404', ''),
+ '#description' => t('This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
);
$form['errors']['error_level'] = array(
- type => 'select', title => t('Error reporting'), default_value => variable_get('error_level', 1),
- options => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
- description => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
+ '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1),
+ '#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
+ '#description' => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
);
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
$period['1000000000'] = t('Never');
$form['errors']['watchdog_clear'] = array(
- type => 'select', title => t('Discard log entries older than'), default_value => variable_get('watchdog_clear', 604800), options => $period,
- description => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')
+ '#type' => 'select', '#title' => t('Discard log entries older than'), '#default_value' => variable_get('watchdog_clear', 604800), '#options' => $period,
+ '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')
);
// Caching:
- $form['cache'] = array(type => 'fieldset', title => t('Cache settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['cache'] = array('#type' => 'fieldset', '#title' => t('Cache settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['cache']['cache'] = array(
- type => 'radios', title => t('Page cache'), default_value => variable_get('cache', CACHE_DISABLED),
- options => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')),
- description => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.")
+ '#type' => 'radios', '#title' => t('Page cache'), '#default_value' => variable_get('cache', CACHE_DISABLED),
+ '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')),
+ '#description' => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.")
);
$period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
$period[0] = t('none');
$form['cache']['cache_lifetime'] = array(
- type => 'select', title => t('Minimum cache lifetime'), default_value => variable_get('cache_lifetime', 0), options => $period,
- description => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites. On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
+ '#type' => 'select', '#title' => t('Minimum cache lifetime'), '#default_value' => variable_get('cache_lifetime', 0), '#options' => $period,
+ '#description' => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites. On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
);
// File system:
- $form['files'] = array(type => 'fieldset', title => t('File system settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['files'] = array('#type' => 'fieldset', '#title' => t('File system settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$directory_path = variable_get('file_directory_path', 'files');
file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
$form['files']['file_directory_path'] = array(
- type => 'textfield', title => t('File system path'), default_value => $directory_path, maxlength => 255, valid => 'directory',
- description => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')
+ '#type' => 'textfield', '#title' => t('File system path'), '#default_value' => $directory_path, '#maxlength' => 255, '#valid' => 'directory',
+ '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')
);
$directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP);
file_check_directory($directory_temp, FILE_CREATE_DIRECTORY, 'file_directory_temp');
$form['files']['file_directory_tmp'] = array(
- type => 'textfield', title => t('Temporary directory'), default_value => $directory_temp, maxlength => 255, valid => 'directory',
- description => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')
+ '#type' => 'textfield', '#title' => t('Temporary directory'), '#default_value' => $directory_temp, '#maxlength' => 255, '#valid' => 'directory',
+ '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')
);
$form['files']['file_downloads'] = array(
- type => 'radios', title => t('Download method'), default_value => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
- options => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
- description => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')
+ '#type' => 'radios', '#title' => t('Download method'), '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
+ '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
+ '#description' => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')
);
/*
@@ -329,28 +343,28 @@ function system_view_general() {
$toolkits_available = image_get_available_toolkits();
if (count($toolkits_available) > 1) {
$group['image_toolkit'] = array(
- type => 'radios', title => t('Select an image processing toolkit'),
- default_value => variable_get('image_toolkit', image_get_toolkit()), options => $toolkits_available
+ '#type' => 'radios', '#title' => t('Select an image processing toolkit'),
+ '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available
);
}
$group['toolkit'] = image_toolkit_invoke('settings');
if (is_array($group)) {
- $form['image'] = array(type => 'fieldset', title => t('Image handling'), collapsible => TRUE, collapsed => true);
+ $form['image'] = array('#type' => 'fieldset', '#title' => t('Image handling'), '#collapsible' => TRUE, '#collapsed' => true);
$form['image'] = array_merge($form['image'], $group);
}
*/
// Feed settings
- $form['feed'] = array(type => 'fieldset', title => t('RSS feed settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['feed'] = array('#type' => 'fieldset', '#title' => t('RSS feed settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['feed']['feed_default_items'] = array(
- type => 'select', title => t('Number of items per feed'), default_value => variable_get('feed_default_items', 10),
- options => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
- description => t('The default number of items to include in a feed.')
+ '#type' => 'select', '#title' => t('Number of items per feed'), '#default_value' => variable_get('feed_default_items', 10),
+ '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
+ '#description' => t('The default number of items to include in a feed.')
);
$form['feed']['feed_item_length'] = array(
- type => 'select', title => t('Display of XML feed items'), default_value => variable_get('feed_item_length','teaser'),
- options => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
- description => t('Global setting for the length of XML feed items that are output by default.')
+ '#type' => 'select', '#title' => t('Display of XML feed items'), '#default_value' => variable_get('feed_item_length','teaser'),
+ '#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
+ '#description' => t('Global setting for the length of XML feed items that are output by default.')
);
// Date settings:
@@ -379,64 +393,64 @@ function system_view_general() {
$datelongchoices[$f] = format_date(time(), 'custom', $f);
}
- $form['dates'] = array(type => 'fieldset', title => t('Date settings'), collapsible => TRUE, collapsed => TRUE);
+ $form['dates'] = array('#type' => 'fieldset', '#title' => t('Date settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['dates']['date_default_timezone'] = array(
- type => 'select', title => t('Default time zone'), default_value => variable_get('date_default_timezone', 0),
- options => $zones, description => t('Select the default site time zone.')
+ '#type' => 'select', '#title' => t('Default time zone'), '#default_value' => variable_get('date_default_timezone', 0),
+ '#options' => $zones, '#description' => t('Select the default site time zone.')
);
$form['dates']['configurable_timezones'] = array(
- type => 'radios', title => t('Configurable time zones'), default_value => variable_get('configurable_timezones', 1), options => array(t('Disabled'), t('Enabled')),
- description => t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.')
+ '#type' => 'radios', '#title' => t('Configurable time zones'), '#default_value' => variable_get('configurable_timezones', 1), '#options' => array(t('Disabled'), t('Enabled')),
+ '#description' => t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.')
);
$form['dates']['date_format_short'] = array(
- type => 'select', title => t('Short date format'), default_value => variable_get('date_format_short', $dateshort[0]),
- options => $dateshortchoices, description => t('The short format of date display.')
+ '#type' => 'select', '#title' => t('Short date format'), '#default_value' => variable_get('date_format_short', $dateshort[0]),
+ '#options' => $dateshortchoices, '#description' => t('The short format of date display.')
);
$form['dates']['date_format_medium'] = array(
- type => 'select', title => t('Medium date format'), default_value => variable_get('date_format_medium', $datemedium[0]),
- options => $datemediumchoices, description => t('The medium sized date display.')
+ '#type' => 'select', '#title' => t('Medium date format'), '#default_value' => variable_get('date_format_medium', $datemedium[0]),
+ '#options' => $datemediumchoices, '#description' => t('The medium sized date display.')
);
$form['dates']['date_format_long'] = array(
- type => 'select', title => t('Long date format'), default_value => variable_get('date_format_long', $datelong[0]),
- options => $datelongchoices, description => t('Longer date format used for detailed display.')
+ '#type' => 'select', '#title' => t('Long date format'), '#default_value' => variable_get('date_format_long', $datelong[0]),
+ '#options' => $datelongchoices, '#description' => t('Longer date format used for detailed display.')
);
$form['dates']['date_first_day'] = array(
- type => 'select', title => t('First day of week'), default_value => variable_get('date_first_day', 0),
- options => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
- description => t('The first day of the week for calendar views.')
+ '#type' => 'select', '#title' => t('First day of week'), '#default_value' => variable_get('date_first_day', 0),
+ '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
+ '#description' => t('The first day of the week for calendar views.')
);
// Site offline/maintenance settings
$form['site_status'] = array(
- type => 'fieldset',
- title => t('Site maintenance'),
- collapsible => TRUE,
- collapsed => TRUE);
+ '#type' => 'fieldset',
+ '#title' => t('Site maintenance'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE);
$form['site_status']['site_offline'] = array(
- type => 'radios',
- title => t('Site status'),
- default_value => variable_get('site_offline', 0),
- options => array(t('Online'), t('Offline')),
- description => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Offline", only users with the "administer site configuration" permission will be able to access your site to perform maintenance, all other visitors will see the site offline message configured below.')
+ '#type' => 'radios',
+ '#title' => t('Site status'),
+ '#default_value' => variable_get('site_offline', 0),
+ '#options' => array(t('Online'), t('Offline')),
+ '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Offline", only users with the "administer site configuration" permission will be able to access your site to perform maintenance, all other visitors will see the site offline message configured below.')
);
$form['site_status']['site_offline_message'] = array(
- type => 'textarea',
- rows => 5,
- title => t('Site offline message'),
- default_value => variable_get('site_offline_message', t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This drupal site'))))),
- description => t('Message to show visitors when site is offline.')
+ '#type' => 'textarea',
+ '#rows' => 5,
+ '#title' => t('Site offline message'),
+ '#default_value' => variable_get('site_offline_message', t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This drupal site'))))),
+ '#description' => t('Message to show visitors when site is offline.')
);
// String handling: report status and errors.
- $form['strings'] = array(type => 'fieldset', title => t('String handling'), collapsible => TRUE, collapsed => TRUE);
+ $form['strings'] = array('#type' => 'fieldset', '#title' => t('String handling'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['strings'] = array_merge($form['strings'], unicode_settings());
return $form;
@@ -657,8 +671,8 @@ function system_initialize_theme_blocks($theme) {
// Add the submit / reset buttons and run drupal_get_form()
function system_settings_form($form_id, $form) {
- $form['buttons']['submit'] = array(type => 'submit', value => t('Save configuration') );
- $form['buttons']['reset'] = array(type => 'submit', value => t('Reset to defaults') );
+ $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
+ $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
if (!empty($_POST) && form_get_errors()) {
drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');
@@ -719,14 +733,14 @@ function system_themes() {
$info->screenshot = dirname($info->filename) . '/screenshot.png';
$screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
- $form[$info->name]['screenshot'] = array(type => 'markup', value => $screenshot);
- $form[$info->name]['description'] = array(type => 'item', title => $info->name, value => dirname($info->filename));
+ $form[$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
+ $form[$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename));
$options[$info->name] = '';
if ($info->status) {
$status[] = $info->name;
}
if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
- $form[$info->name]['operations'] = array(type => 'markup', value => l(t('configure'), 'admin/themes/settings/' . $info->name) );
+ $form[$info->name]['operations'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/themes/settings/' . $info->name) );
}
else {
// Dummy element for form_render. Cleaner than adding a check in the theme function.
@@ -734,10 +748,10 @@ function system_themes() {
}
}
- $form['status'] = array(type => 'checkboxes', options => $options, default_value => $status);
- $form['theme_default'] = array(type => 'radios', options => $options, default_value => variable_get('theme_default', 'bluemarine'));
- $form['buttons']['submit'] = array(type => 'submit', value => t('Save configuration') );
- $form['buttons']['reset'] = array(type => 'submit', value => t('Reset to defaults') );
+ $form['status'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status);
+ $form['theme_default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('theme_default', 'bluemarine'));
+ $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
+ $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
return drupal_get_form('system_themes', $form);
}
@@ -804,8 +818,8 @@ function system_modules() {
$file->description = module_invoke($file->name, 'help', 'admin/modules#description');
- $form['name'][$file->name] = array(value => $file->name);
- $form['description'][$file->name] = array(value => $file->description);
+ $form['name'][$file->name] = array('#value' => $file->name);
+ $form['description'][$file->name] = array('#value' => $file->description);
$options[$file->name] = '';
if ($file->status) {
$status[] = $file->name;
@@ -831,24 +845,24 @@ function system_modules() {
// Handle status checkboxes, including overriding the generated
// checkboxes for required modules.
- $form['status'] = array(type => 'checkboxes', default_value => $status, options => $options, tree => TRUE);
+ $form['status'] = array('#type' => 'checkboxes', '#default_value' => $status, '#options' => $options, '#tree' => TRUE);
$required = array('block', 'filter', 'system', 'user', 'watchdog');
foreach ($required as $require) {
- $form['status'][$require] = array(type => 'hidden', value => 1, suffix => t('required'));
+ $form['status'][$require] = array('#type' => 'hidden', '#value' => 1, '#suffix' => t('required'));
}
/**
* Handle throttle checkboxes, including overriding the generated checkboxes for required modules.
*/
if (module_exist('throttle')) {
- $form['throttle'] = array(type => 'checkboxes', default_value => $throttle, options => $options, tree => TRUE);
+ $form['throttle'] = array('#type' => 'checkboxes', '#default_value' => $throttle, '#options' => $options, '#tree' => TRUE);
$throttle_required = array_merge($required, array('throttle'));
foreach ($throttle_required as $require) {
- $form['throttle'][$require] = array(type => 'hidden', value => 1, suffix => t('required'));
+ $form['throttle'][$require] = array('#type' => 'hidden', '#value' => 1, '#suffix' => t('required'));
}
}
- $form['buttons']['submit'] = array(type => 'submit', value => t('Save configuration'));
+ $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
return drupal_get_form('system_modules', $form);
}
@@ -935,7 +949,7 @@ function system_theme_settings($key = '') {
$var = 'theme_settings';
}
- $form['var'] = array(type => 'hidden', value => $var);
+ $form['var'] = array('#type' => 'hidden', '#value' => $var);
// Check for a new uploaded logo, and use that instead.
if ($file = file_check_upload('logo_upload')) {
@@ -967,36 +981,36 @@ function system_theme_settings($key = '') {
// Logo settings
if ((!$key) || in_array('logo', $features)) {
- $form['logo'] = array(type => 'fieldset', title => t('Logo image settings'));
+ $form['logo'] = array('#type' => 'fieldset', '#title' => t('Logo image settings'));
$form['logo']["default_logo"] = array(
- type => 'checkbox', title => t('Use the default logo'), default_value => $settings['default_logo'], tree => FALSE,
- description => t('Check here if you want the theme to use the logo supplied with it.')
+ '#type' => 'checkbox', '#title' => t('Use the default logo'), '#default_value' => $settings['default_logo'], '#tree' => FALSE,
+ '#description' => t('Check here if you want the theme to use the logo supplied with it.')
);
$form['logo']['logo_path'] = array(
- type => 'textfield', title => t('Path to custom logo'), size => 60, maxlength => 128,
- description => t('The path to the file you would like to use as your logo file instead of the default logo.'));
+ '#type' => 'textfield', '#title' => t('Path to custom logo'), '#size' => 60, '#maxlength' => 128,
+ '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'));
$form['logo']['logo_upload'] = array(
- type => 'file', title => t('Upload logo image'), maxlength => 40,
- description => t("If you don't have direct file access to the server, use this field to upload your logo.")
+ '#type' => 'file', '#title' => t('Upload logo image'), '#maxlength' => 40,
+ '#description' => t("If you don't have direct file access to the server, use this field to upload your logo.")
);
}
// Icon settings
if ((!$key) || in_array('toggle_favicon', $features)) {
- $form['favicon'] = array(type => 'fieldset', title => t('Shortcut icon settings'));
- $form['favicon']['text'] = array(value => t('Your shortcut icon or \'favicon\' is displayed in the address bar and bookmarks of most browsers.'));
+ $form['favicon'] = array('#type' => 'fieldset', '#title' => t('Shortcut icon settings'));
+ $form['favicon']['text'] = array('#value' => t('Your shortcut icon or \'favicon\' is displayed in the address bar and bookmarks of most browsers.'));
$form['favicon']['default_favicon'] = array(
- type => 'checkbox', title => t('Use the default shortcut icon.'), default_value => $settings['default_favicon'],
- description => t('Check here if you want the theme to use the default shortcut icon.')
+ '#type' => 'checkbox', '#title' => t('Use the default shortcut icon.'), '#default_value' => $settings['default_favicon'],
+ '#description' => t('Check here if you want the theme to use the default shortcut icon.')
);
$form['favicon']['favicon_path'] = array(
- type => 'textfield', title => t('Path to custom icon'), default_value => $settings['favicon_path'],
- description => t('The path to the image file you would like to use as your custom shortcut icon.')
+ '#type' => 'textfield', '#title' => t('Path to custom icon'), '#default_value' => $settings['favicon_path'],
+ '#description' => t('The path to the image file you would like to use as your custom shortcut icon.')
);
$form['favicon']['favicon_upload'] = array(
- type => 'file', title => t('Upload icon image'), description => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.")
+ '#type' => 'file', '#title' => t('Upload icon image'), '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.")
);
}
@@ -1011,9 +1025,9 @@ function system_theme_settings($key = '') {
$node_types = module_invoke('node', 'get_types');
if ($node_types) {
$group = '';
- $form['node_info'] = array(type => 'fieldset', title => t('Display post information on'), description => t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type'));
+ $form['node_info'] = array('#type' => 'fieldset', '#title' => t('Display post information on'), '#description' => t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type'));
foreach ($node_types as $type => $name) {
- $form['node_info']["toggle_node_info_$type"] = array(type => 'checkbox', title => $name, default_value => $settings["toggle_node_info_$type"]);
+ $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
}
}
}
@@ -1043,11 +1057,11 @@ function system_theme_settings($key = '') {
$disabled['toggle_search'] = true;
}
- $form['toggles'] = array(type => 'fieldset', title => t('Toggle display'), description => t('Enable or disable the display of certain page elements.'));
+ $form['toggles'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'));
foreach ($toggles as $name => $title) {
if ((!$key) || in_array($name, $features)) {
// disable search box if search.module is disabled
- $form['toggles'][$name] = array(type => 'checkbox', title => $title, default_value => $settings[$name], attributes => isset($disabled[$name]) ? array('disabled' => 'disabled') : NULL);
+ $form['toggles'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name], '#attributes' => isset($disabled[$name]) ? array('disabled' => 'disabled') : NULL);
}
}
@@ -1057,17 +1071,17 @@ function system_theme_settings($key = '') {
if (function_exists($function)) {
if ($themes[$key]->template) {
// file is a template or a style of a template
- $form['specific'] = array(type => 'fieldset', title => t('Engine-specific settings'), description => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix)));
+ $form['specific'] = array('#type' => 'fieldset', '#title' => t('Engine-specific settings'), '#description' => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix)));
}
else {
// file is a theme or a style of a theme
- $form['specific'] = array(type => 'fieldset', title => t('Theme-specific settings'), description => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => $themes[$key]->prefix)));
+ $form['specific'] = array('#type' => 'fieldset', '#title' => t('Theme-specific settings'), '#description' => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => $themes[$key]->prefix)));
}
$group = $function();
$form['specific'] = array_merge($form['specific'], (is_array($group) ? $group : array()));
}
}
- $form[attributes] = array('enctype' => 'multipart/form-data');
+ $form['#attributes'] = array('enctype' => 'multipart/form-data');
return system_settings_form('system_theme_settings', $form);
@@ -1094,21 +1108,21 @@ function system_navigation_links_form($type, $utype) {
variable_set($type . '_link_count', $count);
}
$form = array(
- type => 'item', title => t('_TYPE_ link settings', array('_TYPE_' => $utype)), theme => 'system_navigation_links_form',
- description => t('You can specify your _TYPE_ links here, one link per line.<br /> The link text field is the text you want to link.<br /> The url field is the location the link points to.<br /> The description field is an optional description of where the link points.', array('_TYPE_' => $type))
+ '#type' => 'item', '#title' => t('_TYPE_ link settings', array('_TYPE_' => $utype)), '#theme' => 'system_navigation_links_form',
+ '#description' => t('You can specify your _TYPE_ links here, one link per line.<br /> The link text field is the text you want to link.<br /> The url field is the location the link points to.<br /> The description field is an optional description of where the link points.', array('_TYPE_' => $type))
);
- $form[tree] = TRUE;
+ $form['#tree'] = TRUE;
for ($i = 0; $i < $count; $i++) {
foreach (array('text', 'link', 'description') as $field) {
- $form[$field][$i] = array(type => 'textfield', default_value => $value[$field][$i], size => 15, maxlength => 90);
+ $form[$field][$i] = array('#type' => 'textfield', '#default_value' => $value[$field][$i], '#size' => 15, '#maxlength' => 90);
}
}
$form[$type . '_links_more'] = array(
- type => 'checkbox', title => t('I need more _TYPE_ links.', array('_TYPE_' => $type)), default_value => FALSE,
- description => t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type))
+ '#type' => 'checkbox', '#title' => t('I need more _TYPE_ links.', array('_TYPE_' => $type)), '#default_value' => FALSE,
+ '#description' => t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type))
);
return $form;
}
@@ -1130,9 +1144,9 @@ function theme_system_navigation_links_form(&$form) {
function search_box() {
- $form[action] = url('search');
- $form['keys'] = array(type => 'textfield', size=> 15, value => '', attributes => array('alt' => t('Enter the terms you wish to search for.'), 'class' => 'form-text'));
- $form['submit'] = array(type => 'submit', value => t('search'));
+ $form['#action'] = url('search');
+ $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.'), 'class' => 'form-text'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('search'));
return drupal_get_form('search_box', $form);
}
@@ -1179,12 +1193,12 @@ function confirm_form($form_id, $form, $question, $path, $description = NULL, $y
$description = ($description) ? $description : t('This action cannot be undone.');
drupal_set_title($question);
- $form[attributes] = array('class' => 'confirmation');
- $form['description'] = array(value => $description);
- $form[$name] = array(type => 'hidden', value => 1);
+ $form['#attributes'] = array('class' => 'confirmation');
+ $form['description'] = array('#value' => $description);
+ $form[$name] = array('#type' => 'hidden', '#value' => 1);
- $form['actions'] = array(prefix => '<div class="container-inline">', suffix => '</div>');
- $form['actions']['submit'] = array(type => 'submit', value => $yes ? $yes : t('Confirm'));
- $form['actions']['cancel'] = array(value => l($no ? $no : t('Cancel'), $path));
+ $form['actions'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
+ $form['actions']['submit'] = array('#type' => 'submit', '#value' => $yes ? $yes : t('Confirm'));
+ $form['actions']['cancel'] = array('#value' => l($no ? $no : t('Cancel'), $path));
return drupal_get_form($form_id, $form, 'confirm_form');
}
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index eb4ddf67f..6bf1bdc18 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -107,31 +107,31 @@ function taxonomy_menu($may_cache) {
}
function taxonomy_form_vocabulary($edit = array()) {
- $form['name'] = array(type => 'textfield', title => t('Vocabulary name'), default_value => $edit['name'], size => 60, maxlength => 64, description => t('The name for this vocabulary. Example: "Topic".'), required => TRUE);
-
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => t('Description of the vocabulary; can be used by modules.'));
- $form['help'] = array(type => 'textfield', title => t('Help text'), default_value => $edit['help'], size => 60, maxlength => 255, description => t('Instructions to present to the user when choosing a term.'));
- $form['nodes'] = array(type => 'checkboxes', title => t('Types'), default_value => $edit['nodes'], options => node_get_types(), description => t('A list of node types you want to associate with this vocabulary.'), required => TRUE);
- $form['hierarchy'] = array(type => 'radios', title => t('Hierarchy'), default_value => $edit['hierarchy'], options => array(t('Disabled'), t('Single'), t('Multiple')), description => t('Allows <a href="%help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'))));
- $form['relations'] = array(type => 'checkbox', title => t('Related terms'), default_value => $edit['relations'], return_value => 1, description => t('Allows <a href="%help-url">related terms</a> in this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'related-terms'))));
- $form['tags'] = array(type => 'checkbox', title => t('Free tagging'), default_value => $edit['tags'], return_value => 1, description => t('Content is categorized by typing terms instead of choosing from a list.'));
- $form['multiple'] = array(type => 'checkbox', title => t('Multiple select'), default_value => $edit['multiple'], return_value => 1, description => t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).'));
- $form['required'] = array(type => 'checkbox', title => t('Required'), default_value => $edit['required'], return_value => 1, description => t('If enabled, every node <strong>must</strong> have at least one term in this vocabulary.'));
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Vocabulary name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The name for this vocabulary. Example: "Topic".'), '#required' => TRUE);
+
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => t('Description of the vocabulary; can be used by modules.'));
+ $form['help'] = array('#type' => 'textfield', '#title' => t('Help text'), '#default_value' => $edit['help'], '#size' => 60, '#maxlength' => 255, '#description' => t('Instructions to present to the user when choosing a term.'));
+ $form['nodes'] = array('#type' => 'checkboxes', '#title' => t('Types'), '#default_value' => $edit['nodes'], '#options' => node_get_types(), '#description' => t('A list of node types you want to associate with this vocabulary.'), '#required' => TRUE);
+ $form['hierarchy'] = array('#type' => 'radios', '#title' => t('Hierarchy'), '#default_value' => $edit['hierarchy'], '#options' => array(t('Disabled'), t('Single'), t('Multiple')), '#description' => t('Allows <a href="%help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'))));
+ $form['relations'] = array('#type' => 'checkbox', '#title' => t('Related terms'), '#default_value' => $edit['relations'], '#return_value' => 1, '#description' => t('Allows <a href="%help-url">related terms</a> in this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'related-terms'))));
+ $form['tags'] = array('#type' => 'checkbox', '#title' => t('Free tagging'), '#default_value' => $edit['tags'], '#return_value' => 1, '#description' => t('Content is categorized by typing terms instead of choosing from a list.'));
+ $form['multiple'] = array('#type' => 'checkbox', '#title' => t('Multiple select'), '#default_value' => $edit['multiple'], '#return_value' => 1, '#description' => t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).'));
+ $form['required'] = array('#type' => 'checkbox', '#title' => t('Required'), '#default_value' => $edit['required'], '#return_value' => 1, '#description' => t('If enabled, every node <strong>must</strong> have at least one term in this vocabulary.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.'));
// Add extra vocabulary form elements.
$extra = module_invoke_all('taxonomy', 'form', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
- $extra[$key][weight] = isset($extra[$key][weight]) ? $nodeapi[$key][weight] : -18;
+ $extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['vid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['vid'] = array(type => 'hidden', value => $edit['vid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => $edit['vid']);
}
return drupal_get_form('taxonomy_form_vocabulary', $form);
}
@@ -189,9 +189,9 @@ function taxonomy_del_vocabulary($vid) {
function _taxonomy_confirm_del_vocabulary($vid) {
$vocabulary = taxonomy_get_vocabulary($vid);
- $form['type'] = array(type => 'hidden', value => 'vocabulary');
- $form['vid'] = array(type => 'hidden', value => $vid);
- $form['name'] = array(type => 'hidden', value => $vocabulary->name);
+ $form['type'] = array('#type' => 'hidden', '#value' => 'vocabulary');
+ $form['vid'] = array('#type' => 'hidden', '#value' => $vid);
+ $form['name'] = array('#type' => 'hidden', '#value' => $vocabulary->name);
return confirm_form('vocabulary_confirm_delete', $form,
t('Are you sure you want to delete the vocabulary %title?',
array('%title' => theme('placeholder', $vocabulary->name))),
@@ -204,9 +204,9 @@ function taxonomy_form_term($edit = array()) {
$vocabulary_id = isset($edit['vid']) ? $edit['vid'] : arg(4);
$vocabulary = taxonomy_get_vocabulary($vocabulary_id);
- $form['name'] = array(type => 'textfield', title => t('Term name'), default_value => $edit['name'], size => 60, maxlength => 64, description => t('The name for this term. Example: "Linux".'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Term name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The name for this term. Example: "Linux".'), '#required' => TRUE);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => t('A description of the term.'));
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => t('A description of the term.'));
if ($vocabulary->hierarchy) {
$parent = array_keys(taxonomy_get_parents($edit['tid']));
@@ -230,28 +230,28 @@ function taxonomy_form_term($edit = array()) {
$form['relations'] = _taxonomy_term_select(t('Related terms'), 'relations', array_keys(taxonomy_get_related($edit['tid'])), $vocabulary_id, NULL, 1, '<'. t('none') .'>', array($edit['tid']));
}
- $form['synonyms'] = array(type => 'textarea', title => t('Synonyms'), default_value => implode("\n", taxonomy_get_synonyms($edit['tid'])), cols => 60, rows => 5, description => t('<a href="%help-url">Synonyms</a> of this term, one synonym per line.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));
+ $form['synonyms'] = array('#type' => 'textarea', '#title' => t('Synonyms'), '#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])), '#cols' => 60, '#rows' => 5, '#description' => t('<a href="%help-url">Synonyms</a> of this term, one synonym per line.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));
// Add extra term form elements.
$extra = module_invoke_all('taxonomy', 'term', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
- $extra[$key][weight] = isset($extra[$key][weight]) ? $nodeapi[$key][weight] : -18;
+ $extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
- $form['vid'] = array(type => 'hidden', value => $vocabulary->vid);
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => $vocabulary->vid);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['tid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['tid'] = array(type => 'hidden', value => $edit['tid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
}
else {
- $form['destination'] = array(type => 'hidden', value => $_GET['q']);
+ $form['destination'] = array('#type' => 'hidden', '#value' => $_GET['q']);
}
return drupal_get_form('taxonomy_form_term', $form);
@@ -353,8 +353,8 @@ function taxonomy_del_term($tid) {
function _taxonomy_confirm_del_term($tid) {
$term = taxonomy_get_term($tid);
- $form['type'] = array(type => 'hidden', value => 'term');
- $form['tid'] = array(type => 'hidden', value => $tid);
+ $form['type'] = array('#type' => 'hidden', '#value' => 'term');
+ $form['tid'] = array('#type' => 'hidden', '#value' => $tid);
return confirm_form('term_confirm_delete', $form,
t('Are you sure you want to delete the term %title?',
array('%title' => theme('placeholder', $term->name))),
@@ -489,7 +489,7 @@ function taxonomy_get_vocabularies($type = NULL) {
/**
* Generate a form for selecting terms to associate with a node.
*/
-function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy') {
+function taxonomy_node_form($node) {
if (!array_key_exists('taxonomy', $node)) {
if ($node->nid) {
$terms = taxonomy_node_get_terms($node->nid);
@@ -502,7 +502,7 @@ function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy')
$terms = $node->taxonomy;
}
- $c = db_query(db_rewrite_sql("SELECT v.*, n.type FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $type);
+ $c = db_query(db_rewrite_sql("SELECT v.*, n.type FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $node->type);
while ($vocabulary = db_fetch_object($c)) {
if ($vocabulary->tags) {
$typed_terms = array();
@@ -519,21 +519,21 @@ function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy')
}
$typed_string = implode(', ', $typed_terms) . (array_key_exists('tags', $terms) ? $terms['tags'][$vocabulary->vid] : NULL);
-
- $form[$name]['tags'][$vocabulary->vid] = array(type => textfield, default_value => $typed_string, size => 60, maxlength => 100, autocomplete_path => 'taxonomy/autocomplete/'. $vocabulary->vid, required => $vocabulary->required, title => $vocabulary->name, description => t('A comma-separated list of terms describing this content (Example: funny, bungie jumping, "Company, Inc.").'));
+ $form['taxonomy']['tags'][$vocabulary->vid] = array('#type' => textfield, '#default_value' => $typed_string, '#size' => 60, '#maxlength' => 100, '#autocomplete_path' => 'taxonomy/autocomplete/'. $vocabulary->vid, '#required' => $vocabulary->required, '#title' => $vocabulary->name, '#description' => t('A comma-separated list of terms describing this content (Example: funny, bungie jumping, "Company, Inc.").'));
}
else {
$ntterms = array_key_exists('taxonomy', $node) ? $terms : array_keys($terms);
- $form[$name][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, $name);
- if ($vocabulary->multiple) {
- $form[$name][$vocabulary->vid][parents] = array($name);
- }
- else {
- $form[$name][$vocabulary->vid][tree] = TRUE;
- }
+ $form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, 'taxonomy');
}
}
- return $form ? $form : array();
+ if ($form) {
+ $form['taxonomy']['#tree'] = TRUE;
+ $form['taxonomy']['#weight'] = -15;
+ return $form;
+ }
+ else {
+ return array();
+ }
}
/**
@@ -904,7 +904,7 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti
$value = $tree[0]->tid;
}
}
- return array(type => 'select', title => $title, default_value => $value, options => $options, description => $description, multiple => $multiple, size => $multiple ? 'size="'. min(12, count($options)) .'"' : 0, weight => -15);
+ return array('#type' => 'select', '#title' => $title, '#default_value' => $value, '#options' => $options, '#description' => $description, '#multiple' => $multiple, '#size' => $multiple ? 'size="'. min(12, count($options)) .'"' : 0, '#weight' => -15);
}
function _taxonomy_depth($depth, $graphic = '--') {
@@ -1037,6 +1037,9 @@ function taxonomy_nodeapi($node, $op, $arg = 0) {
case 'rss item':
return taxonomy_rss_item($node);
break;
+ case 'form':
+ return taxonomy_node_form($node);
+ break;
}
}
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index eb4ddf67f..6bf1bdc18 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -107,31 +107,31 @@ function taxonomy_menu($may_cache) {
}
function taxonomy_form_vocabulary($edit = array()) {
- $form['name'] = array(type => 'textfield', title => t('Vocabulary name'), default_value => $edit['name'], size => 60, maxlength => 64, description => t('The name for this vocabulary. Example: "Topic".'), required => TRUE);
-
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => t('Description of the vocabulary; can be used by modules.'));
- $form['help'] = array(type => 'textfield', title => t('Help text'), default_value => $edit['help'], size => 60, maxlength => 255, description => t('Instructions to present to the user when choosing a term.'));
- $form['nodes'] = array(type => 'checkboxes', title => t('Types'), default_value => $edit['nodes'], options => node_get_types(), description => t('A list of node types you want to associate with this vocabulary.'), required => TRUE);
- $form['hierarchy'] = array(type => 'radios', title => t('Hierarchy'), default_value => $edit['hierarchy'], options => array(t('Disabled'), t('Single'), t('Multiple')), description => t('Allows <a href="%help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'))));
- $form['relations'] = array(type => 'checkbox', title => t('Related terms'), default_value => $edit['relations'], return_value => 1, description => t('Allows <a href="%help-url">related terms</a> in this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'related-terms'))));
- $form['tags'] = array(type => 'checkbox', title => t('Free tagging'), default_value => $edit['tags'], return_value => 1, description => t('Content is categorized by typing terms instead of choosing from a list.'));
- $form['multiple'] = array(type => 'checkbox', title => t('Multiple select'), default_value => $edit['multiple'], return_value => 1, description => t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).'));
- $form['required'] = array(type => 'checkbox', title => t('Required'), default_value => $edit['required'], return_value => 1, description => t('If enabled, every node <strong>must</strong> have at least one term in this vocabulary.'));
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Vocabulary name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The name for this vocabulary. Example: "Topic".'), '#required' => TRUE);
+
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => t('Description of the vocabulary; can be used by modules.'));
+ $form['help'] = array('#type' => 'textfield', '#title' => t('Help text'), '#default_value' => $edit['help'], '#size' => 60, '#maxlength' => 255, '#description' => t('Instructions to present to the user when choosing a term.'));
+ $form['nodes'] = array('#type' => 'checkboxes', '#title' => t('Types'), '#default_value' => $edit['nodes'], '#options' => node_get_types(), '#description' => t('A list of node types you want to associate with this vocabulary.'), '#required' => TRUE);
+ $form['hierarchy'] = array('#type' => 'radios', '#title' => t('Hierarchy'), '#default_value' => $edit['hierarchy'], '#options' => array(t('Disabled'), t('Single'), t('Multiple')), '#description' => t('Allows <a href="%help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'))));
+ $form['relations'] = array('#type' => 'checkbox', '#title' => t('Related terms'), '#default_value' => $edit['relations'], '#return_value' => 1, '#description' => t('Allows <a href="%help-url">related terms</a> in this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'related-terms'))));
+ $form['tags'] = array('#type' => 'checkbox', '#title' => t('Free tagging'), '#default_value' => $edit['tags'], '#return_value' => 1, '#description' => t('Content is categorized by typing terms instead of choosing from a list.'));
+ $form['multiple'] = array('#type' => 'checkbox', '#title' => t('Multiple select'), '#default_value' => $edit['multiple'], '#return_value' => 1, '#description' => t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).'));
+ $form['required'] = array('#type' => 'checkbox', '#title' => t('Required'), '#default_value' => $edit['required'], '#return_value' => 1, '#description' => t('If enabled, every node <strong>must</strong> have at least one term in this vocabulary.'));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.'));
// Add extra vocabulary form elements.
$extra = module_invoke_all('taxonomy', 'form', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
- $extra[$key][weight] = isset($extra[$key][weight]) ? $nodeapi[$key][weight] : -18;
+ $extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['vid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['vid'] = array(type => 'hidden', value => $edit['vid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => $edit['vid']);
}
return drupal_get_form('taxonomy_form_vocabulary', $form);
}
@@ -189,9 +189,9 @@ function taxonomy_del_vocabulary($vid) {
function _taxonomy_confirm_del_vocabulary($vid) {
$vocabulary = taxonomy_get_vocabulary($vid);
- $form['type'] = array(type => 'hidden', value => 'vocabulary');
- $form['vid'] = array(type => 'hidden', value => $vid);
- $form['name'] = array(type => 'hidden', value => $vocabulary->name);
+ $form['type'] = array('#type' => 'hidden', '#value' => 'vocabulary');
+ $form['vid'] = array('#type' => 'hidden', '#value' => $vid);
+ $form['name'] = array('#type' => 'hidden', '#value' => $vocabulary->name);
return confirm_form('vocabulary_confirm_delete', $form,
t('Are you sure you want to delete the vocabulary %title?',
array('%title' => theme('placeholder', $vocabulary->name))),
@@ -204,9 +204,9 @@ function taxonomy_form_term($edit = array()) {
$vocabulary_id = isset($edit['vid']) ? $edit['vid'] : arg(4);
$vocabulary = taxonomy_get_vocabulary($vocabulary_id);
- $form['name'] = array(type => 'textfield', title => t('Term name'), default_value => $edit['name'], size => 60, maxlength => 64, description => t('The name for this term. Example: "Linux".'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Term name'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 64, '#description' => t('The name for this term. Example: "Linux".'), '#required' => TRUE);
- $form['description'] = array(type => 'textarea', title => t('Description'), default_value => $edit['description'], cols => 60, rows => 5, description => t('A description of the term.'));
+ $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5, '#description' => t('A description of the term.'));
if ($vocabulary->hierarchy) {
$parent = array_keys(taxonomy_get_parents($edit['tid']));
@@ -230,28 +230,28 @@ function taxonomy_form_term($edit = array()) {
$form['relations'] = _taxonomy_term_select(t('Related terms'), 'relations', array_keys(taxonomy_get_related($edit['tid'])), $vocabulary_id, NULL, 1, '<'. t('none') .'>', array($edit['tid']));
}
- $form['synonyms'] = array(type => 'textarea', title => t('Synonyms'), default_value => implode("\n", taxonomy_get_synonyms($edit['tid'])), cols => 60, rows => 5, description => t('<a href="%help-url">Synonyms</a> of this term, one synonym per line.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));
- $form['weight'] = array(type => 'weight', title => t('Weight'), default_value => $edit['weight'], delta => 10, description => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));
+ $form['synonyms'] = array('#type' => 'textarea', '#title' => t('Synonyms'), '#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])), '#cols' => 60, '#rows' => 5, '#description' => t('<a href="%help-url">Synonyms</a> of this term, one synonym per line.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));
+ $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#delta' => 10, '#description' => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));
// Add extra term form elements.
$extra = module_invoke_all('taxonomy', 'term', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
- $extra[$key][weight] = isset($extra[$key][weight]) ? $nodeapi[$key][weight] : -18;
+ $extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
- $form['vid'] = array(type => 'hidden', value => $vocabulary->vid);
- $form['submit'] = array(type => 'submit', value => t('Submit'));
+ $form['vid'] = array('#type' => 'hidden', '#value' => $vocabulary->vid);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
if ($edit['tid']) {
- $form['delete'] = array(type => 'submit', value => t('Delete'));
- $form['tid'] = array(type => 'hidden', value => $edit['tid']);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
+ $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
}
else {
- $form['destination'] = array(type => 'hidden', value => $_GET['q']);
+ $form['destination'] = array('#type' => 'hidden', '#value' => $_GET['q']);
}
return drupal_get_form('taxonomy_form_term', $form);
@@ -353,8 +353,8 @@ function taxonomy_del_term($tid) {
function _taxonomy_confirm_del_term($tid) {
$term = taxonomy_get_term($tid);
- $form['type'] = array(type => 'hidden', value => 'term');
- $form['tid'] = array(type => 'hidden', value => $tid);
+ $form['type'] = array('#type' => 'hidden', '#value' => 'term');
+ $form['tid'] = array('#type' => 'hidden', '#value' => $tid);
return confirm_form('term_confirm_delete', $form,
t('Are you sure you want to delete the term %title?',
array('%title' => theme('placeholder', $term->name))),
@@ -489,7 +489,7 @@ function taxonomy_get_vocabularies($type = NULL) {
/**
* Generate a form for selecting terms to associate with a node.
*/
-function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy') {
+function taxonomy_node_form($node) {
if (!array_key_exists('taxonomy', $node)) {
if ($node->nid) {
$terms = taxonomy_node_get_terms($node->nid);
@@ -502,7 +502,7 @@ function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy')
$terms = $node->taxonomy;
}
- $c = db_query(db_rewrite_sql("SELECT v.*, n.type FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $type);
+ $c = db_query(db_rewrite_sql("SELECT v.*, n.type FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $node->type);
while ($vocabulary = db_fetch_object($c)) {
if ($vocabulary->tags) {
$typed_terms = array();
@@ -519,21 +519,21 @@ function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy')
}
$typed_string = implode(', ', $typed_terms) . (array_key_exists('tags', $terms) ? $terms['tags'][$vocabulary->vid] : NULL);
-
- $form[$name]['tags'][$vocabulary->vid] = array(type => textfield, default_value => $typed_string, size => 60, maxlength => 100, autocomplete_path => 'taxonomy/autocomplete/'. $vocabulary->vid, required => $vocabulary->required, title => $vocabulary->name, description => t('A comma-separated list of terms describing this content (Example: funny, bungie jumping, "Company, Inc.").'));
+ $form['taxonomy']['tags'][$vocabulary->vid] = array('#type' => textfield, '#default_value' => $typed_string, '#size' => 60, '#maxlength' => 100, '#autocomplete_path' => 'taxonomy/autocomplete/'. $vocabulary->vid, '#required' => $vocabulary->required, '#title' => $vocabulary->name, '#description' => t('A comma-separated list of terms describing this content (Example: funny, bungie jumping, "Company, Inc.").'));
}
else {
$ntterms = array_key_exists('taxonomy', $node) ? $terms : array_keys($terms);
- $form[$name][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, $name);
- if ($vocabulary->multiple) {
- $form[$name][$vocabulary->vid][parents] = array($name);
- }
- else {
- $form[$name][$vocabulary->vid][tree] = TRUE;
- }
+ $form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, 'taxonomy');
}
}
- return $form ? $form : array();
+ if ($form) {
+ $form['taxonomy']['#tree'] = TRUE;
+ $form['taxonomy']['#weight'] = -15;
+ return $form;
+ }
+ else {
+ return array();
+ }
}
/**
@@ -904,7 +904,7 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti
$value = $tree[0]->tid;
}
}
- return array(type => 'select', title => $title, default_value => $value, options => $options, description => $description, multiple => $multiple, size => $multiple ? 'size="'. min(12, count($options)) .'"' : 0, weight => -15);
+ return array('#type' => 'select', '#title' => $title, '#default_value' => $value, '#options' => $options, '#description' => $description, '#multiple' => $multiple, '#size' => $multiple ? 'size="'. min(12, count($options)) .'"' : 0, '#weight' => -15);
}
function _taxonomy_depth($depth, $graphic = '--') {
@@ -1037,6 +1037,9 @@ function taxonomy_nodeapi($node, $op, $arg = 0) {
case 'rss item':
return taxonomy_rss_item($node);
break;
+ case 'form':
+ return taxonomy_node_form($node);
+ break;
}
}
diff --git a/modules/throttle.module b/modules/throttle.module
index a24441d33..f1d1ce5e8 100644
--- a/modules/throttle.module
+++ b/modules/throttle.module
@@ -124,27 +124,27 @@ function throttle_settings() {
$probabilities = array(0 => '100%', 1 => '50%', 2 => '33.3%', 3 => '25%', 4 => '20%', 5 => '16.6%', 7 => '12.5%', 9 => '10%', 19 => '5%', 99 => '1%', 199 => '.5%', 399 => '.25%', 989 => '.1%');
$form['throttle_anonymous'] = array(
- type => 'textfield',
- title => t('Auto-throttle on anonymous users'),
- default_value => variable_get('throttle_anonymous', 0),
- size => 5,
- maxlength => 6,
- description => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.')
+ '#type' => 'textfield',
+ '#title' => t('Auto-throttle on anonymous users'),
+ '#default_value' => variable_get('throttle_anonymous', 0),
+ '#size' => 5,
+ '#maxlength' => 6,
+ '#description' => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.')
);
$form['throttle_user'] = array(
- type => 'textfield',
- title => t('Auto-throttle on authenticated users'),
- default_value => variable_get('throttle_user', 0),
- size => 5,
- maxlength => 6,
- description => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.')
+ '#type' => 'textfield',
+ '#title' => t('Auto-throttle on authenticated users'),
+ '#default_value' => variable_get('throttle_user', 0),
+ '#size' => 5,
+ '#maxlength' => 6,
+ '#description' => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.')
);
$form['throttle_probability_limiter'] = array(
- type => 'select',
- title => t('Auto-throttle probability limiter'),
- default_value => variable_get('throttle_probability_limiter', 9),
- options => $probabilities,
- description => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.')
+ '#type' => 'select',
+ '#title' => t('Auto-throttle probability limiter'),
+ '#default_value' => variable_get('throttle_probability_limiter', 9),
+ '#options' => $probabilities,
+ '#description' => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.')
);
return $form;
diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module
index a24441d33..f1d1ce5e8 100644
--- a/modules/throttle/throttle.module
+++ b/modules/throttle/throttle.module
@@ -124,27 +124,27 @@ function throttle_settings() {
$probabilities = array(0 => '100%', 1 => '50%', 2 => '33.3%', 3 => '25%', 4 => '20%', 5 => '16.6%', 7 => '12.5%', 9 => '10%', 19 => '5%', 99 => '1%', 199 => '.5%', 399 => '.25%', 989 => '.1%');
$form['throttle_anonymous'] = array(
- type => 'textfield',
- title => t('Auto-throttle on anonymous users'),
- default_value => variable_get('throttle_anonymous', 0),
- size => 5,
- maxlength => 6,
- description => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.')
+ '#type' => 'textfield',
+ '#title' => t('Auto-throttle on anonymous users'),
+ '#default_value' => variable_get('throttle_anonymous', 0),
+ '#size' => 5,
+ '#maxlength' => 6,
+ '#description' => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.')
);
$form['throttle_user'] = array(
- type => 'textfield',
- title => t('Auto-throttle on authenticated users'),
- default_value => variable_get('throttle_user', 0),
- size => 5,
- maxlength => 6,
- description => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.')
+ '#type' => 'textfield',
+ '#title' => t('Auto-throttle on authenticated users'),
+ '#default_value' => variable_get('throttle_user', 0),
+ '#size' => 5,
+ '#maxlength' => 6,
+ '#description' => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.')
);
$form['throttle_probability_limiter'] = array(
- type => 'select',
- title => t('Auto-throttle probability limiter'),
- default_value => variable_get('throttle_probability_limiter', 9),
- options => $probabilities,
- description => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.')
+ '#type' => 'select',
+ '#title' => t('Auto-throttle probability limiter'),
+ '#default_value' => variable_get('throttle_probability_limiter', 9),
+ '#options' => $probabilities,
+ '#description' => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.')
);
return $form;
diff --git a/modules/upload.module b/modules/upload.module
index ec2209016..50f795bc2 100644
--- a/modules/upload.module
+++ b/modules/upload.module
@@ -81,27 +81,27 @@ function upload_menu($may_cache) {
}
function upload_settings() {
- $form['settings_general'] = array(type => 'fieldset', title => t('General settings'));
+ $form['settings_general'] = array('#type' => 'fieldset', '#title' => t('General settings'));
$form['settings_general']['upload_max_resolution'] = array(
- type => 'textfield', title => t('Maximum resolution for uploaded images'), default_value => variable_get('upload_max_resolution', 0),
- size => 15, maxlength => 10, description => t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.')
+ '#type' => 'textfield', '#title' => t('Maximum resolution for uploaded images'), '#default_value' => variable_get('upload_max_resolution', 0),
+ '#size' => 15, '#maxlength' => 10, '#description' => t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.')
);
$roles = user_roles(0, 'upload files');
foreach ($roles as $rid => $role) {
- $form["settings_role_$rid"] = array(type => 'fieldset', title => t('Settings for %role', array('%role' => theme('placeholder', $role))), collapsible => TRUE, collapsed => TRUE);
+ $form["settings_role_$rid"] = array('#type' => 'fieldset', '#title' => t('Settings for %role', array('%role' => theme('placeholder', $role))), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form["settings_role_$rid"]["upload_extensions_$rid"] = array(
- type => 'textfield', title => t('Permitted file extensions'), default_value => variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"),
- size => 60, maxlength => 255, description => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.')
+ '#type' => 'textfield', '#title' => t('Permitted file extensions'), '#default_value' => variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"),
+ '#size' => 60, '#maxlength' => 255, '#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.')
);
$form["settings_role_$rid"]["upload_uploadsize_$rid"] = array(
- type => 'textfield', title => t('Maximum file size per upload'), default_value => variable_get("upload_uploadsize_$rid", 1),
- size => 5, maxlength => 5, description => t('The maximum size of a file a user can upload (in megabytes).')
+ '#type' => 'textfield', '#title' => t('Maximum file size per upload'), '#default_value' => variable_get("upload_uploadsize_$rid", 1),
+ '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of a file a user can upload (in megabytes).')
);
$form["settings_role_$rid"]["upload_usersize_$rid"] = array(
- type => 'textfield', title => t('Total file size per user'), default_value => variable_get("upload_usersize_$rid", 10),
- size => 5, maxlength => 5, description => t('The maximum size of all files a user can have on the site (in megabytes).')
+ '#type' => 'textfield', '#title' => t('Total file size per user'), '#default_value' => variable_get("upload_usersize_$rid", 10),
+ '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of all files a user can have on the site (in megabytes).')
);
}
@@ -138,8 +138,8 @@ function upload_nodeapi(&$node, $op, $arg) {
switch ($op) {
case 'settings':
$form['upload_'. $node->type] = array(
- type => 'radios', title => t('Attachments'), default_value => variable_get('upload_'. $node->type, 1),
- options => array(t('Disabled'), t('Enabled'))
+ '#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $node->type, 1),
+ '#options' => array(t('Disabled'), t('Enabled'))
);
return $form;
case 'validate':
@@ -229,7 +229,7 @@ function upload_nodeapi(&$node, $op, $arg) {
case 'form':
if (variable_get("upload_$node->type", 1) == 1 && user_access('upload files')) {
$output = upload_form($node);
- $output[attributes] = array('enctype' => 'multipart/form-data');
+ $output['#attributes'] = array('enctype' => 'multipart/form-data');
}
break;
@@ -393,9 +393,9 @@ function upload_form($node) {
drupal_add_js('misc/upload.js');
$form['attachments'] = array(
- type => 'fieldset', title => t('File attachments'), collapsible => TRUE, collapsed => empty($node->files),
- description => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
- prefix => '<div class="attachments">', suffix => '</div>', weight => 15
+ '#type' => 'fieldset', '#title' => t('File attachments'), '#collapsible' => TRUE, '#collapsed' => empty($node->files),
+ '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
+ '#prefix' => '<div class="attachments">', '#suffix' => '</div>', '#weight' => 15
);
$form['attachments'] += _upload_form($node);
@@ -407,10 +407,10 @@ function _upload_form($node) {
$rows = array();
$output = '';
- $form[theme] = 'upload_form_new';
+ $form['#theme'] = 'upload_form_new';
if (is_array($node->files) && count($node->files)) {
- $form['current'][theme] = 'upload_form_current';
- $form['current']['description'][tree] = TRUE;
+ $form['current']['#theme'] = 'upload_form_current';
+ $form['current']['description']['#tree'] = TRUE;
foreach ($node->files as $key => $file) {
$options[$key] = '';
if ($file->remove) {
@@ -420,20 +420,20 @@ function _upload_form($node) {
$list[] = $key;
}
$description = "<small>". file_create_url(($file->fid ? $file->filepath : file_create_filename($file->filename, file_create_path()))) ."</small>";
- $form['current']['description'][$key] = array(type => 'textfield', default_value => $file->description ? $file->description : $file->filename, size => 60, maxlength => 256, description => $description );
- $form['current']['size'][$key] = array(type => 'markup', value => format_size($file->filesize));
+ $form['current']['description'][$key] = array('#type' => 'textfield', '#default_value' => $file->description ? $file->description : $file->filename, '#size' => 60, '#maxlength' => 256, '#description' => $description );
+ $form['current']['size'][$key] = array('#type' => 'markup', '#value' => format_size($file->filesize));
}
- $form['current']['remove'] = array(type => 'checkboxes', options => $options, default_value => $remove);
- $form['current']['list'] = array(type => 'checkboxes', options => $options, default_value => $list);
- $form['files'][$key] = array(type => 'hidden', value => 1);
+ $form['current']['remove'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $remove);
+ $form['current']['list'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $list);
+ $form['files'][$key] = array('#type' => 'hidden', '#value' => 1);
}
if (user_access('upload files')) {
- $form['new']['upload'] = array(type => 'file', title => t('Attach new file'), size => 40);
- $form['new']['fileop'] = array(type => 'button', value => t('Attach'), name=> 'fileop', attributes => array('id' => 'fileop'));
+ $form['new']['upload'] = array('#type' => 'file', '#title' => t('Attach new file'), '#size' => 40);
+ $form['new']['fileop'] = array('#type' => 'button', '#value' => t('Attach'), '#name'=> 'fileop', '#attributes' => array('id' => 'fileop'));
// The class triggers the js upload behaviour.
- $form['fileop'] = array(type => 'hidden', value => url('upload/js', NULL, NULL, TRUE), attributes => array('class' => 'upload'));
+ $form['fileop'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
}
return $form;
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index ec2209016..50f795bc2 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -81,27 +81,27 @@ function upload_menu($may_cache) {
}
function upload_settings() {
- $form['settings_general'] = array(type => 'fieldset', title => t('General settings'));
+ $form['settings_general'] = array('#type' => 'fieldset', '#title' => t('General settings'));
$form['settings_general']['upload_max_resolution'] = array(
- type => 'textfield', title => t('Maximum resolution for uploaded images'), default_value => variable_get('upload_max_resolution', 0),
- size => 15, maxlength => 10, description => t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.')
+ '#type' => 'textfield', '#title' => t('Maximum resolution for uploaded images'), '#default_value' => variable_get('upload_max_resolution', 0),
+ '#size' => 15, '#maxlength' => 10, '#description' => t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.')
);
$roles = user_roles(0, 'upload files');
foreach ($roles as $rid => $role) {
- $form["settings_role_$rid"] = array(type => 'fieldset', title => t('Settings for %role', array('%role' => theme('placeholder', $role))), collapsible => TRUE, collapsed => TRUE);
+ $form["settings_role_$rid"] = array('#type' => 'fieldset', '#title' => t('Settings for %role', array('%role' => theme('placeholder', $role))), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form["settings_role_$rid"]["upload_extensions_$rid"] = array(
- type => 'textfield', title => t('Permitted file extensions'), default_value => variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"),
- size => 60, maxlength => 255, description => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.')
+ '#type' => 'textfield', '#title' => t('Permitted file extensions'), '#default_value' => variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"),
+ '#size' => 60, '#maxlength' => 255, '#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.')
);
$form["settings_role_$rid"]["upload_uploadsize_$rid"] = array(
- type => 'textfield', title => t('Maximum file size per upload'), default_value => variable_get("upload_uploadsize_$rid", 1),
- size => 5, maxlength => 5, description => t('The maximum size of a file a user can upload (in megabytes).')
+ '#type' => 'textfield', '#title' => t('Maximum file size per upload'), '#default_value' => variable_get("upload_uploadsize_$rid", 1),
+ '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of a file a user can upload (in megabytes).')
);
$form["settings_role_$rid"]["upload_usersize_$rid"] = array(
- type => 'textfield', title => t('Total file size per user'), default_value => variable_get("upload_usersize_$rid", 10),
- size => 5, maxlength => 5, description => t('The maximum size of all files a user can have on the site (in megabytes).')
+ '#type' => 'textfield', '#title' => t('Total file size per user'), '#default_value' => variable_get("upload_usersize_$rid", 10),
+ '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of all files a user can have on the site (in megabytes).')
);
}
@@ -138,8 +138,8 @@ function upload_nodeapi(&$node, $op, $arg) {
switch ($op) {
case 'settings':
$form['upload_'. $node->type] = array(
- type => 'radios', title => t('Attachments'), default_value => variable_get('upload_'. $node->type, 1),
- options => array(t('Disabled'), t('Enabled'))
+ '#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $node->type, 1),
+ '#options' => array(t('Disabled'), t('Enabled'))
);
return $form;
case 'validate':
@@ -229,7 +229,7 @@ function upload_nodeapi(&$node, $op, $arg) {
case 'form':
if (variable_get("upload_$node->type", 1) == 1 && user_access('upload files')) {
$output = upload_form($node);
- $output[attributes] = array('enctype' => 'multipart/form-data');
+ $output['#attributes'] = array('enctype' => 'multipart/form-data');
}
break;
@@ -393,9 +393,9 @@ function upload_form($node) {
drupal_add_js('misc/upload.js');
$form['attachments'] = array(
- type => 'fieldset', title => t('File attachments'), collapsible => TRUE, collapsed => empty($node->files),
- description => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
- prefix => '<div class="attachments">', suffix => '</div>', weight => 15
+ '#type' => 'fieldset', '#title' => t('File attachments'), '#collapsible' => TRUE, '#collapsed' => empty($node->files),
+ '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
+ '#prefix' => '<div class="attachments">', '#suffix' => '</div>', '#weight' => 15
);
$form['attachments'] += _upload_form($node);
@@ -407,10 +407,10 @@ function _upload_form($node) {
$rows = array();
$output = '';
- $form[theme] = 'upload_form_new';
+ $form['#theme'] = 'upload_form_new';
if (is_array($node->files) && count($node->files)) {
- $form['current'][theme] = 'upload_form_current';
- $form['current']['description'][tree] = TRUE;
+ $form['current']['#theme'] = 'upload_form_current';
+ $form['current']['description']['#tree'] = TRUE;
foreach ($node->files as $key => $file) {
$options[$key] = '';
if ($file->remove) {
@@ -420,20 +420,20 @@ function _upload_form($node) {
$list[] = $key;
}
$description = "<small>". file_create_url(($file->fid ? $file->filepath : file_create_filename($file->filename, file_create_path()))) ."</small>";
- $form['current']['description'][$key] = array(type => 'textfield', default_value => $file->description ? $file->description : $file->filename, size => 60, maxlength => 256, description => $description );
- $form['current']['size'][$key] = array(type => 'markup', value => format_size($file->filesize));
+ $form['current']['description'][$key] = array('#type' => 'textfield', '#default_value' => $file->description ? $file->description : $file->filename, '#size' => 60, '#maxlength' => 256, '#description' => $description );
+ $form['current']['size'][$key] = array('#type' => 'markup', '#value' => format_size($file->filesize));
}
- $form['current']['remove'] = array(type => 'checkboxes', options => $options, default_value => $remove);
- $form['current']['list'] = array(type => 'checkboxes', options => $options, default_value => $list);
- $form['files'][$key] = array(type => 'hidden', value => 1);
+ $form['current']['remove'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $remove);
+ $form['current']['list'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $list);
+ $form['files'][$key] = array('#type' => 'hidden', '#value' => 1);
}
if (user_access('upload files')) {
- $form['new']['upload'] = array(type => 'file', title => t('Attach new file'), size => 40);
- $form['new']['fileop'] = array(type => 'button', value => t('Attach'), name=> 'fileop', attributes => array('id' => 'fileop'));
+ $form['new']['upload'] = array('#type' => 'file', '#title' => t('Attach new file'), '#size' => 40);
+ $form['new']['fileop'] = array('#type' => 'button', '#value' => t('Attach'), '#name'=> 'fileop', '#attributes' => array('id' => 'fileop'));
// The class triggers the js upload behaviour.
- $form['fileop'] = array(type => 'hidden', value => url('upload/js', NULL, NULL, TRUE), attributes => array('class' => 'upload'));
+ $form['fileop'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
}
return $form;
diff --git a/modules/user.module b/modules/user.module
index f71713e23..2647d7ab4 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -467,7 +467,7 @@ function user_search($op = 'search', $keys = null) {
*/
function user_user($type, &$edit, &$user, $category = NULL) {
if ($type == 'view') {
- $form['member'] = array(type => 'item', title => t('Member for'), value => format_interval(time() - $user->created));
+ $form['member'] = array('#type' => 'item', '#title' => t('Member for'), '#value' => format_interval(time() - $user->created));
return array(t('History') => array('history'=> drupal_get_form('member', $form)));
}
@@ -500,8 +500,8 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
}
else if ($op == 'configure' && $delta == 3) {
$period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval');
- $form['user_block_seconds_online'] = array(type => 'select', title => t('User activity'), default_value => variable_get('user_block_seconds_online', 900), options => $period, description => t('A user is considered online for this long after they have last viewed a page.'));
- $form['user_block_max_list_count'] = array(type => 'select', title => t('User list length'), default_value => variable_get('user_block_max_list_count', 10), options => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), description => t('Maximum number of currently online users to display.'));
+ $form['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online', 900), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.'));
+ $form['user_block_max_list_count'] = array('#type' => 'select', '#title' => t('User list length'), '#default_value' => variable_get('user_block_max_list_count', 10), '#options' => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), '#description' => t('Maximum number of currently online users to display.'));
//return drupal_get_form('user_block', $form);
return $form;
@@ -517,9 +517,9 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
case 0:
// For usability's sake, avoid showing two login forms on one page.
if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
- $form['name'] = array(type => 'textfield', title => t('Username'), maxlength => 64, size => 15);
- $form['pass'] = array(type => 'password', title => t('Password'), maxlength => 64, size => 15);
- $form['submit'] = array(type => 'submit', value => t('Log in'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#maxlength' => 64, '#size' => 15);
+ $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#maxlength' => 64, '#size' => 15);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
$output .= drupal_get_form('user_login_block', $form, 'user_login');
if (variable_get('user_register', 1)) {
$items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
@@ -877,7 +877,7 @@ function user_login($edit = array(), $msg = '') {
// Display error message (if any):
if ($error) {
- $form['error'] = array(type => 'value', value => 1);
+ $form['error'] = array('#type' => 'value', '#value' => 1);
drupal_set_message($error, 'error');
}
@@ -885,15 +885,15 @@ function user_login($edit = array(), $msg = '') {
if ($msg) {
$output .= "<p>$msg</p>";
}
- $form['name'] = array(type => 'textfield', title => t('Username'), size => 30, maxlength => 64, required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#size' => 30, '#maxlength' => 64, '#required' => TRUE);
if (count(user_auth_help_links()) > 0) {
- $form['name'][description] = t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links())));
+ $form['name']['#description'] = t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links())));
}
else {
- $form['name'][description] = t('Enter your %s username.', array('%s' => variable_get('site_name', 'local')));
+ $form['name']['#description'] = t('Enter your %s username.', array('%s' => variable_get('site_name', 'local')));
}
- $form['pass'] = array(type => 'password', title => t('Password'), size => 30, maxlength => 64, description => t('Enter the password that accompanies your username.'), required => TRUE);
- $form['submit'] = array(type => 'submit', value => t('Log in'), weight => 2);
+ $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#size' => 30, '#maxlength' => 64, '#description' => t('Enter the password that accompanies your username.'), '#required' => TRUE);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'), '#weight' => 2);
return drupal_get_form('user_login', $form);
}
@@ -1004,9 +1004,9 @@ function user_pass() {
drupal_set_message(t('You must provide either a username or e-mail address.'), 'error');
}
// Display form:
- $form['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 30, maxlength => 64);
- $form['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 30, maxlength => 64);
- $form['submit'] = array(type => 'submit', value => t('E-mail new password'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 30, '#maxlength' => 64);
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 30, '#maxlength' => 64);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('E-mail new password'));
return drupal_get_form('user_logout', $form);
}
}
@@ -1093,11 +1093,11 @@ function user_register($edit = array()) {
if ($account->uid == 1) {
user_mail($edit['mail'], t('drupal user account details for %s', array('%s' => $edit['name'])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password.
- $form['instructions'] = array(type => 'markup', value => "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <strong>$pass</strong>. You may change your password on the next page.</p><p>Please login below.</p>");
- $form[action] = 'user/'. $account->uid .'/edit';
- $form['name'] = array(type => 'hidden', value => $account->name);
- $form['pass'] = array(type => 'hidden', value => $pass);
- $form['submit'] = array(type => 'submit', value => t('Log in'));
+ $form['instructions'] = array('#type' => 'markup', '#value' => "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <strong>$pass</strong>. You may change your password on the next page.</p><p>Please login below.</p>");
+ $form['#action'] = 'user/'. $account->uid .'/edit';
+ $form['name'] = array('#type' => 'hidden', '#value' => $account->name);
+ $form['pass'] = array('#type' => 'hidden', '#value' => $pass);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
return drupal_get_form('user_register', $form);
}
else {
@@ -1127,22 +1127,22 @@ function user_register($edit = array()) {
}
// Display the registration form.
- $form['user_registration_help'] = array(type => 'markup', value => variable_get('user_registration_help', ''));
+ $form['user_registration_help'] = array('#type' => 'markup', '#value' => variable_get('user_registration_help', ''));
$affiliates = user_auth_help_links();
if (!$admin && count($affiliates) > 0) {
$affiliates = implode(', ', $affiliates);
- $form['affiliates'] = array(type => 'markup', value => '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>');
+ $form['affiliates'] = array('#type' => 'markup', '#value' => '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>');
}
- $form['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 30, maxlength => 64, description => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), required => TRUE);
- $form['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 30, maxlength => 64, description => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 30, '#maxlength' => 64, '#description' => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), '#required' => TRUE);
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 30, '#maxlength' => 64, '#description' => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), '#required' => TRUE);
if ($admin) {
- $form['pass'] = array(type => 'password', title => t('Password'), default_value => $edit['pass'], size => 30, maxlength => 55, description => t('Provide a password for the new account.'), required => TRUE);
+ $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#default_value' => $edit['pass'], '#size' => 30, '#maxlength' => 55, '#description' => t('Provide a password for the new account.'), '#required' => TRUE);
}
$extra = _user_forms($edit, $account, $category, 'register');
// Only display form_group around default fields if there are other groups.
if ($extra) {
- $form['account'] = array(type => 'fieldset', value => t('Account information'));
+ $form['account'] = array('#type' => 'fieldset', '#value' => t('Account information'));
$form['account']['name'] = $form['name'];
$form['account']['mail'] = $form['mail'];
$form['account']['pass'] = $form['pass'];
@@ -1151,30 +1151,30 @@ function user_register($edit = array()) {
unset($form['pass']);
$form = array_merge($form, $extra);
}
- $form['submit'] = array(type => 'submit', value => t('Create new account'), weight => 30);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Create new account'), '#weight' => 30);
return drupal_get_form('user_register', $form);
}
function user_edit_form($uid, $edit) {
// Account information:
- $form['account'] = array(type => 'fieldset', title => t('Account information'), weight => 0);
- $form['account']['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 60, maxlength => 55, description => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), required => TRUE);
- $form['account']['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 60, maxlength => 55, description => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), required => TRUE);
- $form['account']['pass'] = array(type => 'item', title => t('Password'), value => '<input type="password" class="form-password" name="edit[pass1]" size="12" maxlength="24" /> <input type="password" class="form-password" name="edit[pass2]" size="12" maxlength="24" />', required => true);
+ $form['account'] = array('#type' => 'fieldset', '#title' => t('Account information'), '#weight' => 0);
+ $form['account']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 55, '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), '#required' => TRUE);
+ $form['account']['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 60, '#maxlength' => 55, '#description' => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), '#required' => TRUE);
+ $form['account']['pass'] = array('#type' => 'item', '#title' => t('Password'), '#value' => '<input type="password" class="form-password" name="edit[pass1]" size="12" maxlength="24" /> <input type="password" class="form-password" name="edit[pass2]" size="12" maxlength="24" />', '#required' => true);
if (user_access('administer access control')) {
- $form['account']['status'] = array(type => 'radios', title => t('Status'), default_value => $edit['status'], options => array(t('Blocked'), t('Active')));
- $form['account']['roles'] = array(type => 'checkboxes', title => t('Roles'), default_value => array_keys($edit['roles']), options => user_roles(1), description => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), required => TRUE);
+ $form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => $edit['status'], '#options' => array(t('Blocked'), t('Active')));
+ $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys($edit['roles']), '#options' => user_roles(1), '#description' => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), '#required' => TRUE);
}
// Picture/avatar:
if (variable_get('user_pictures', 0)) {
- $form['picture'] = array(type => 'fieldset', title => t('Picture'), weight => 1);
+ $form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1);
if ($edit['picture'] && ($picture = theme('user_picture', array2object($edit)))) {
- $form['picture']['current_picture'] = array(type => 'markup', value => $picture);
- $form['picture']['picture_delete'] = array(type => 'checkbox', title => t('Delete picture'), return_value => 1, default_value => 0, description => t('Check this box to delete your current picture.'));
+ $form['picture']['current_picture'] = array('#type' => 'markup', '#value' => $picture);
+ $form['picture']['picture_delete'] = array('#type' => 'checkbox', '#title' => t('Delete picture'), '#return_value' => 1, '#default_value' => 0, '#description' => t('Check this box to delete your current picture.'));
}
- $form['picture']['picture'] = array(type => 'file', title => t('Upload picture'), size => 48, description => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', ''));
+ $form['picture']['picture'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', ''));
}
return $form;
@@ -1284,11 +1284,11 @@ function user_edit($category = 'account') {
}
$form = _user_forms($edit, $account, $category);
- $form['submit'] = array(type => 'submit', value => t('Submit'), weight => 30);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 30);
if (user_access('administer users')) {
- $form['delete'] = array(type => 'submit', value => t('Delete'), weight => 30);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'), '#weight' => 30);
}
- $form[attributes] = array('enctype' => 'multipart/form-data');
+ $form['#attributes'] = array('enctype' => 'multipart/form-data');
drupal_set_title($account->name);
return drupal_get_form('user_edit', $form);
@@ -1412,24 +1412,24 @@ function user_admin_access_check() {
}
}
- $form['user'] = array(type => 'fieldset', title => t('Username'));
- $form['user']['test'] = array(type => 'textfield', title => '', description => t('Enter a username to check if it will be denied or allowed.'), size => 30, maxlength => 64);
- $form['user']['type'] = array(type => 'hidden', value => 'user');
- $form['user']['submit'] = array(type => 'submit', value => t('Check username'));
+ $form['user'] = array('#type' => 'fieldset', '#title' => t('Username'));
+ $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+ $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user');
+ $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username'));
$output .= drupal_get_form('check_user', $form);
unset($form); // prevent endless loop?
- $form['mail'] = array(type => 'fieldset', title => t('E-mail'));
- $form['mail']['test'] = array(type => 'textfield', title => '', description => t('Enter an e-mail address to check if it will be denied or allowed.'), size => 30, maxlength => 64);
- $form['mail']['type'] = array(type => 'hidden', value => 'mail');
- $form['mail']['submit'] = array(type => 'submit', value => t('Check e-mail'));
+ $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail'));
+ $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+ $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail');
+ $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail'));
$output .= drupal_get_form('check_mail', $form);
unset($form); // prevent endless loop?
- $form['host'] = array(type => 'fieldset', title => t('Hostname'));
- $form['host']['test'] = array(type => 'textfield', title => '', description => t('Enter a hostname or IP address to check if it will be denied or allowed.'), size => 30, maxlength => 64);
- $form['host']['type'] = array(type => 'hidden', value => 'host');
- $form['host']['submit'] = array(type => 'submit', value => t('Check hostname'));
+ $form['host'] = array('#type' => 'fieldset', '#title' => t('Hostname'));
+ $form['host']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a hostname or IP address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+ $form['host']['type'] = array('#type' => 'hidden', '#value' => 'host');
+ $form['host']['submit'] = array('#type' => 'submit', '#value' => t('Check hostname'));
$output .= drupal_get_form('check_host', $form);
unset($form); // prevent endless loop?
@@ -1457,7 +1457,7 @@ function user_admin_access_add($mask = NULL, $type = NULL) {
}
$form = _user_admin_access_form($edit);
- $form['submit'] = array(type => 'submit', value => t('Add rule'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Add rule'));
return drupal_get_form('access_rule', $form);
}
@@ -1470,7 +1470,7 @@ function user_admin_access_delete($aid = 0) {
$edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
$form = array();
- $form['aid'] = array(type => 'hidden', value => $aid);
+ $form['aid'] = array('#type' => 'hidden', '#value' => $aid);
$output = confirm_form('user_admin_access_delete_confirm', $form,
t('Are you sure you want to delete the %type rule for %rule?', array('%type' => $access_types[$edit->type], '%rule' => theme('placeholder', $edit->mask))),
'admin/access/rules',
@@ -1504,15 +1504,15 @@ function user_admin_access_edit($aid = 0) {
$edit = db_fetch_array(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
}
$form = _user_admin_access_form($edit);
- $form['submit'] = array(type => 'submit', value => t('Save rule'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save rule'));
return drupal_get_form('access_rule', $form);
}
function _user_admin_access_form($edit) {
- $form['status'] = array(type => 'radios', title => t('Access type'), default_value => $edit['status'], options => array('1' => t('Allow'), '0' => t('Deny')));
- $form['type'] = array(type => 'radios', title => t('Rule type'), default_value => $edit['type'], options => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'), default_value => 'host'));
- $form['mask'] = array(type => 'textfield', title => t('Mask'), default_value => $edit['mask'], size => 30, maxlength => 64, description => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), required => TRUE);
+ $form['status'] = array('#type' => 'radios', '#title' => t('Access type'), '#default_value' => $edit['status'], '#options' => array('1' => t('Allow'), '0' => t('Deny')));
+ $form['type'] = array('#type' => 'radios', '#title' => t('Rule type'), '#default_value' => $edit['type'], '#options' => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'), '#default_value' => 'host'));
+ $form['mask'] = array('#type' => 'textfield', '#title' => t('Mask'), '#default_value' => $edit['mask'], '#size' => 30, '#maxlength' => 64, '#description' => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), '#required' => TRUE);
return $form;
}
@@ -1575,11 +1575,11 @@ function user_admin_perm() {
$options = array();
foreach (module_list() as $module) {
if ($permissions = module_invoke($module, 'perm')) {
- $form['permission'][] = array(type => 'markup', value => t('%module module', array('%module' => $module)));
+ $form['permission'][] = array('#type' => 'markup', '#value' => t('%module module', array('%module' => $module)));
asort($permissions);
foreach ($permissions as $perm) {
$options[$perm] = '';
- $form['permission'][$perm] = array(type => 'markup', value => t($perm));
+ $form['permission'][$perm] = array('#type' => 'markup', '#value' => t($perm));
foreach ($role_names as $rid => $name) {
// Builds arrays for checked boxes for each role
if (strstr($role_permissions[$rid], $perm)) {
@@ -1591,10 +1591,10 @@ function user_admin_perm() {
}
// Have to build checkboxes here after checkbox arrays are built
foreach ($role_names as $rid => $name) {
- $form['checkboxes'][$rid] = array(type => 'checkboxes', options => $options, default_value => $status[$rid], tree => TRUE);
- $form['role_names'][$rid] = array(type => 'markup', value => $name, tree => TRUE);
+ $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status[$rid], '#tree' => TRUE);
+ $form['role_names'][$rid] = array('#type' => 'markup', '#value' => $name, '#tree' => TRUE);
}
- $form['submit'] = array(type => 'submit', value => t('Save permissions'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
return drupal_get_form('user_admin_perm', $form);
}
@@ -1708,13 +1708,13 @@ function user_admin_role() {
else if ($id) {
// Display the role form.
$role = db_fetch_object(db_query('SELECT * FROM {role} WHERE rid = %d', $id));
- $form['name'] = array(type => 'textfield', title => t('Role name'), default_value => $role->name, size => 30, maxlength => 64, description => t('The name for this role. Example: "moderator", "editorial board", "site architect".'));
- $form['submit'] = array(type => 'submit', value => t('Save role'));
- $form['delete'] = array(type => 'submit', value => t('Delete role'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Role name'), '#default_value' => $role->name, '#size' => 30, '#maxlength' => 64, '#description' => t('The name for this role. Example: "moderator", "editorial board", "site architect".'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save role'));
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete role'));
return drupal_get_form('user_admin_role', $form);
}
- $form['name'] = array(type => 'textfield', size => 32, maxlength => 64);
- $form['submit'] = array(type => 'submit', value => t('Add role'));
+ $form['name'] = array('#type' => 'textfield', '#size' => 32, '#maxlength' => 64);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Add role'));
return drupal_get_form('user_admin_new_role', $form);
}
@@ -1765,18 +1765,18 @@ function user_admin_account() {
function user_configure() {
// User registration settings.
- $form['registration'] = array(type => 'fieldset', title => t('User registration settings'));
- $form['registration']['user_register'] = array(type => 'radios', title => t('Public registrations'), default_value => variable_get('user_register', 1), options => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
- $form['registration']['user_registration_help'] = array(type => 'textarea', title => t('User registration guidelines'), default_value => variable_get('user_registration_help', ''), cols => 60, rows => 5, description => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.'));
+ $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
+ $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
+ $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#cols' => 60, '#rows' => 5, '#description' => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.'));
// User e-mail settings.
- $form['email'] = array(type => 'fieldset', title => t('User email settings'));
- $form['email']['user_mail_welcome_subject'] = array(type => 'textfield', title => t('Subject of welcome e-mail'), default_value => _user_mail_text('welcome_subject'), size => 60, maxlength => 180, description => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_welcome_body'] = array(type => 'textarea', title => t('Body of welcome e-mail'), default_value => _user_mail_text('welcome_body'), cols => 60, rows => 15, description => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_approval_subject'] = array(type => 'textfield', title => t('Subject of welcome e-mail (awaiting admin approval)'), default_value => _user_mail_text('approval_subject'), size => 60, maxlength => 180, description => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_approval_body'] = array(type => 'textarea', title => t('Body of welcome e-mail (awaiting admin approval)'), default_value => _user_mail_text('approval_body'), cols => 60, rows => 15, description => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_pass_subject'] = array(type => 'textfield', title => t('Subject of password recovery e-mail'), default_value => _user_mail_text('pass_subject'), size => 60, maxlength => 180, description => t('Customize the Subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri.');
- $form['email']['user_mail_pass_body'] = array(type => 'textarea', title => t('Body of password recovery e-mail'), default_value => _user_mail_text('pass_body'), cols => 60, rows => 15, description => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %login_uri, %edit_uri.');
+ $form['email'] = array('#type' => 'fieldset', '#title' => t('User email settings'));
+ $form['email']['user_mail_welcome_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail'), '#default_value' => _user_mail_text('welcome_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_welcome_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail'), '#default_value' => _user_mail_text('welcome_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_approval_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_approval_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_pass_subject'] = array('#type' => 'textfield', '#title' => t('Subject of password recovery e-mail'), '#default_value' => _user_mail_text('pass_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the Subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri.');
+ $form['email']['user_mail_pass_body'] = array('#type' => 'textarea', '#title' => t('Body of password recovery e-mail'), '#default_value' => _user_mail_text('pass_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %login_uri, %edit_uri.');
// If picture support is enabled, check whether the picture directory exists:
if (variable_get('user_pictures', 0)) {
@@ -1784,13 +1784,13 @@ function user_configure() {
file_check_directory($picture_path, 1, 'user_picture_path');
}
- $form['pictures'] = array(type => 'fieldset', title => t('Pictures'));
- $form['pictures']['user_pictures'] = array(type => 'radios', title => t('Picture support'), default_value => variable_get('user_pictures', 0), options => array(t('Disabled'), t('Enabled')), description => t('Enable picture support.'));
- $form['pictures']['user_picture_path'] = array(type => 'textfield', title => t('Picture image path'), default_value => variable_get('user_picture_path', 'pictures'), size => 30, maxlength => 255, description => t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/')));
- $form['pictures']['user_picture_default'] = array(type => 'textfield', title => t('Default picture'), default_value => variable_get('user_picture_default', ''), size => 30, maxlength => 255, description => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
- $form['pictures']['user_picture_dimensions'] = array(type => 'textfield', title => t('Picture maximum dimensions'), default_value => variable_get('user_picture_dimensions', '85x85'), size => 15, maxlength => 10, description => t('Maximum dimensions for pictures.'));
- $form['pictures']['user_picture_file_size'] = array(type => 'textfield', title => t('Picture maximum file size'), default_value => variable_get('user_picture_file_size', '30'), size => 15, maxlength => 10, description => t('Maximum file size for pictures, in kB.'));
- $form['pictures']['user_picture_guidelines'] = array(type => 'textarea', title => t('Picture guidelines'), default_value => variable_get('user_picture_guidelines', ''), cols => 60, rows => 5, description => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.'));
+ $form['pictures'] = array('#type' => 'fieldset', '#title' => t('Pictures'));
+ $form['pictures']['user_pictures'] = array('#type' => 'radios', '#title' => t('Picture support'), '#default_value' => variable_get('user_pictures', 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable picture support.'));
+ $form['pictures']['user_picture_path'] = array('#type' => 'textfield', '#title' => t('Picture image path'), '#default_value' => variable_get('user_picture_path', 'pictures'), '#size' => 30, '#maxlength' => 255, '#description' => t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/')));
+ $form['pictures']['user_picture_default'] = array('#type' => 'textfield', '#title' => t('Default picture'), '#default_value' => variable_get('user_picture_default', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
+ $form['pictures']['user_picture_dimensions'] = array('#type' => 'textfield', '#title' => t('Picture maximum dimensions'), '#default_value' => variable_get('user_picture_dimensions', '85x85'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum dimensions for pictures.'));
+ $form['pictures']['user_picture_file_size'] = array('#type' => 'textfield', '#title' => t('Picture maximum file size'), '#default_value' => variable_get('user_picture_file_size', '30'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum file size for pictures, in kB.'));
+ $form['pictures']['user_picture_guidelines'] = array('#type' => 'textarea', '#title' => t('Picture guidelines'), '#default_value' => variable_get('user_picture_guidelines', ''), '#cols' => 60, '#rows' => 5, '#description' => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.'));
return system_settings_form('user_configure_settings', $form);
}
diff --git a/modules/user/user.module b/modules/user/user.module
index f71713e23..2647d7ab4 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -467,7 +467,7 @@ function user_search($op = 'search', $keys = null) {
*/
function user_user($type, &$edit, &$user, $category = NULL) {
if ($type == 'view') {
- $form['member'] = array(type => 'item', title => t('Member for'), value => format_interval(time() - $user->created));
+ $form['member'] = array('#type' => 'item', '#title' => t('Member for'), '#value' => format_interval(time() - $user->created));
return array(t('History') => array('history'=> drupal_get_form('member', $form)));
}
@@ -500,8 +500,8 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
}
else if ($op == 'configure' && $delta == 3) {
$period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval');
- $form['user_block_seconds_online'] = array(type => 'select', title => t('User activity'), default_value => variable_get('user_block_seconds_online', 900), options => $period, description => t('A user is considered online for this long after they have last viewed a page.'));
- $form['user_block_max_list_count'] = array(type => 'select', title => t('User list length'), default_value => variable_get('user_block_max_list_count', 10), options => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), description => t('Maximum number of currently online users to display.'));
+ $form['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online', 900), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.'));
+ $form['user_block_max_list_count'] = array('#type' => 'select', '#title' => t('User list length'), '#default_value' => variable_get('user_block_max_list_count', 10), '#options' => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), '#description' => t('Maximum number of currently online users to display.'));
//return drupal_get_form('user_block', $form);
return $form;
@@ -517,9 +517,9 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
case 0:
// For usability's sake, avoid showing two login forms on one page.
if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
- $form['name'] = array(type => 'textfield', title => t('Username'), maxlength => 64, size => 15);
- $form['pass'] = array(type => 'password', title => t('Password'), maxlength => 64, size => 15);
- $form['submit'] = array(type => 'submit', value => t('Log in'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#maxlength' => 64, '#size' => 15);
+ $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#maxlength' => 64, '#size' => 15);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
$output .= drupal_get_form('user_login_block', $form, 'user_login');
if (variable_get('user_register', 1)) {
$items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
@@ -877,7 +877,7 @@ function user_login($edit = array(), $msg = '') {
// Display error message (if any):
if ($error) {
- $form['error'] = array(type => 'value', value => 1);
+ $form['error'] = array('#type' => 'value', '#value' => 1);
drupal_set_message($error, 'error');
}
@@ -885,15 +885,15 @@ function user_login($edit = array(), $msg = '') {
if ($msg) {
$output .= "<p>$msg</p>";
}
- $form['name'] = array(type => 'textfield', title => t('Username'), size => 30, maxlength => 64, required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#size' => 30, '#maxlength' => 64, '#required' => TRUE);
if (count(user_auth_help_links()) > 0) {
- $form['name'][description] = t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links())));
+ $form['name']['#description'] = t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links())));
}
else {
- $form['name'][description] = t('Enter your %s username.', array('%s' => variable_get('site_name', 'local')));
+ $form['name']['#description'] = t('Enter your %s username.', array('%s' => variable_get('site_name', 'local')));
}
- $form['pass'] = array(type => 'password', title => t('Password'), size => 30, maxlength => 64, description => t('Enter the password that accompanies your username.'), required => TRUE);
- $form['submit'] = array(type => 'submit', value => t('Log in'), weight => 2);
+ $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#size' => 30, '#maxlength' => 64, '#description' => t('Enter the password that accompanies your username.'), '#required' => TRUE);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'), '#weight' => 2);
return drupal_get_form('user_login', $form);
}
@@ -1004,9 +1004,9 @@ function user_pass() {
drupal_set_message(t('You must provide either a username or e-mail address.'), 'error');
}
// Display form:
- $form['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 30, maxlength => 64);
- $form['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 30, maxlength => 64);
- $form['submit'] = array(type => 'submit', value => t('E-mail new password'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 30, '#maxlength' => 64);
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 30, '#maxlength' => 64);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('E-mail new password'));
return drupal_get_form('user_logout', $form);
}
}
@@ -1093,11 +1093,11 @@ function user_register($edit = array()) {
if ($account->uid == 1) {
user_mail($edit['mail'], t('drupal user account details for %s', array('%s' => $edit['name'])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password.
- $form['instructions'] = array(type => 'markup', value => "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <strong>$pass</strong>. You may change your password on the next page.</p><p>Please login below.</p>");
- $form[action] = 'user/'. $account->uid .'/edit';
- $form['name'] = array(type => 'hidden', value => $account->name);
- $form['pass'] = array(type => 'hidden', value => $pass);
- $form['submit'] = array(type => 'submit', value => t('Log in'));
+ $form['instructions'] = array('#type' => 'markup', '#value' => "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <strong>$pass</strong>. You may change your password on the next page.</p><p>Please login below.</p>");
+ $form['#action'] = 'user/'. $account->uid .'/edit';
+ $form['name'] = array('#type' => 'hidden', '#value' => $account->name);
+ $form['pass'] = array('#type' => 'hidden', '#value' => $pass);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
return drupal_get_form('user_register', $form);
}
else {
@@ -1127,22 +1127,22 @@ function user_register($edit = array()) {
}
// Display the registration form.
- $form['user_registration_help'] = array(type => 'markup', value => variable_get('user_registration_help', ''));
+ $form['user_registration_help'] = array('#type' => 'markup', '#value' => variable_get('user_registration_help', ''));
$affiliates = user_auth_help_links();
if (!$admin && count($affiliates) > 0) {
$affiliates = implode(', ', $affiliates);
- $form['affiliates'] = array(type => 'markup', value => '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>');
+ $form['affiliates'] = array('#type' => 'markup', '#value' => '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>');
}
- $form['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 30, maxlength => 64, description => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), required => TRUE);
- $form['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 30, maxlength => 64, description => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), required => TRUE);
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 30, '#maxlength' => 64, '#description' => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), '#required' => TRUE);
+ $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 30, '#maxlength' => 64, '#description' => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), '#required' => TRUE);
if ($admin) {
- $form['pass'] = array(type => 'password', title => t('Password'), default_value => $edit['pass'], size => 30, maxlength => 55, description => t('Provide a password for the new account.'), required => TRUE);
+ $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#default_value' => $edit['pass'], '#size' => 30, '#maxlength' => 55, '#description' => t('Provide a password for the new account.'), '#required' => TRUE);
}
$extra = _user_forms($edit, $account, $category, 'register');
// Only display form_group around default fields if there are other groups.
if ($extra) {
- $form['account'] = array(type => 'fieldset', value => t('Account information'));
+ $form['account'] = array('#type' => 'fieldset', '#value' => t('Account information'));
$form['account']['name'] = $form['name'];
$form['account']['mail'] = $form['mail'];
$form['account']['pass'] = $form['pass'];
@@ -1151,30 +1151,30 @@ function user_register($edit = array()) {
unset($form['pass']);
$form = array_merge($form, $extra);
}
- $form['submit'] = array(type => 'submit', value => t('Create new account'), weight => 30);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Create new account'), '#weight' => 30);
return drupal_get_form('user_register', $form);
}
function user_edit_form($uid, $edit) {
// Account information:
- $form['account'] = array(type => 'fieldset', title => t('Account information'), weight => 0);
- $form['account']['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 60, maxlength => 55, description => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), required => TRUE);
- $form['account']['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 60, maxlength => 55, description => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), required => TRUE);
- $form['account']['pass'] = array(type => 'item', title => t('Password'), value => '<input type="password" class="form-password" name="edit[pass1]" size="12" maxlength="24" /> <input type="password" class="form-password" name="edit[pass2]" size="12" maxlength="24" />', required => true);
+ $form['account'] = array('#type' => 'fieldset', '#title' => t('Account information'), '#weight' => 0);
+ $form['account']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 55, '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), '#required' => TRUE);
+ $form['account']['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 60, '#maxlength' => 55, '#description' => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), '#required' => TRUE);
+ $form['account']['pass'] = array('#type' => 'item', '#title' => t('Password'), '#value' => '<input type="password" class="form-password" name="edit[pass1]" size="12" maxlength="24" /> <input type="password" class="form-password" name="edit[pass2]" size="12" maxlength="24" />', '#required' => true);
if (user_access('administer access control')) {
- $form['account']['status'] = array(type => 'radios', title => t('Status'), default_value => $edit['status'], options => array(t('Blocked'), t('Active')));
- $form['account']['roles'] = array(type => 'checkboxes', title => t('Roles'), default_value => array_keys($edit['roles']), options => user_roles(1), description => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), required => TRUE);
+ $form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => $edit['status'], '#options' => array(t('Blocked'), t('Active')));
+ $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys($edit['roles']), '#options' => user_roles(1), '#description' => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), '#required' => TRUE);
}
// Picture/avatar:
if (variable_get('user_pictures', 0)) {
- $form['picture'] = array(type => 'fieldset', title => t('Picture'), weight => 1);
+ $form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1);
if ($edit['picture'] && ($picture = theme('user_picture', array2object($edit)))) {
- $form['picture']['current_picture'] = array(type => 'markup', value => $picture);
- $form['picture']['picture_delete'] = array(type => 'checkbox', title => t('Delete picture'), return_value => 1, default_value => 0, description => t('Check this box to delete your current picture.'));
+ $form['picture']['current_picture'] = array('#type' => 'markup', '#value' => $picture);
+ $form['picture']['picture_delete'] = array('#type' => 'checkbox', '#title' => t('Delete picture'), '#return_value' => 1, '#default_value' => 0, '#description' => t('Check this box to delete your current picture.'));
}
- $form['picture']['picture'] = array(type => 'file', title => t('Upload picture'), size => 48, description => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', ''));
+ $form['picture']['picture'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', ''));
}
return $form;
@@ -1284,11 +1284,11 @@ function user_edit($category = 'account') {
}
$form = _user_forms($edit, $account, $category);
- $form['submit'] = array(type => 'submit', value => t('Submit'), weight => 30);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 30);
if (user_access('administer users')) {
- $form['delete'] = array(type => 'submit', value => t('Delete'), weight => 30);
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'), '#weight' => 30);
}
- $form[attributes] = array('enctype' => 'multipart/form-data');
+ $form['#attributes'] = array('enctype' => 'multipart/form-data');
drupal_set_title($account->name);
return drupal_get_form('user_edit', $form);
@@ -1412,24 +1412,24 @@ function user_admin_access_check() {
}
}
- $form['user'] = array(type => 'fieldset', title => t('Username'));
- $form['user']['test'] = array(type => 'textfield', title => '', description => t('Enter a username to check if it will be denied or allowed.'), size => 30, maxlength => 64);
- $form['user']['type'] = array(type => 'hidden', value => 'user');
- $form['user']['submit'] = array(type => 'submit', value => t('Check username'));
+ $form['user'] = array('#type' => 'fieldset', '#title' => t('Username'));
+ $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+ $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user');
+ $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username'));
$output .= drupal_get_form('check_user', $form);
unset($form); // prevent endless loop?
- $form['mail'] = array(type => 'fieldset', title => t('E-mail'));
- $form['mail']['test'] = array(type => 'textfield', title => '', description => t('Enter an e-mail address to check if it will be denied or allowed.'), size => 30, maxlength => 64);
- $form['mail']['type'] = array(type => 'hidden', value => 'mail');
- $form['mail']['submit'] = array(type => 'submit', value => t('Check e-mail'));
+ $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail'));
+ $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+ $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail');
+ $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail'));
$output .= drupal_get_form('check_mail', $form);
unset($form); // prevent endless loop?
- $form['host'] = array(type => 'fieldset', title => t('Hostname'));
- $form['host']['test'] = array(type => 'textfield', title => '', description => t('Enter a hostname or IP address to check if it will be denied or allowed.'), size => 30, maxlength => 64);
- $form['host']['type'] = array(type => 'hidden', value => 'host');
- $form['host']['submit'] = array(type => 'submit', value => t('Check hostname'));
+ $form['host'] = array('#type' => 'fieldset', '#title' => t('Hostname'));
+ $form['host']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a hostname or IP address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+ $form['host']['type'] = array('#type' => 'hidden', '#value' => 'host');
+ $form['host']['submit'] = array('#type' => 'submit', '#value' => t('Check hostname'));
$output .= drupal_get_form('check_host', $form);
unset($form); // prevent endless loop?
@@ -1457,7 +1457,7 @@ function user_admin_access_add($mask = NULL, $type = NULL) {
}
$form = _user_admin_access_form($edit);
- $form['submit'] = array(type => 'submit', value => t('Add rule'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Add rule'));
return drupal_get_form('access_rule', $form);
}
@@ -1470,7 +1470,7 @@ function user_admin_access_delete($aid = 0) {
$edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
$form = array();
- $form['aid'] = array(type => 'hidden', value => $aid);
+ $form['aid'] = array('#type' => 'hidden', '#value' => $aid);
$output = confirm_form('user_admin_access_delete_confirm', $form,
t('Are you sure you want to delete the %type rule for %rule?', array('%type' => $access_types[$edit->type], '%rule' => theme('placeholder', $edit->mask))),
'admin/access/rules',
@@ -1504,15 +1504,15 @@ function user_admin_access_edit($aid = 0) {
$edit = db_fetch_array(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
}
$form = _user_admin_access_form($edit);
- $form['submit'] = array(type => 'submit', value => t('Save rule'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save rule'));
return drupal_get_form('access_rule', $form);
}
function _user_admin_access_form($edit) {
- $form['status'] = array(type => 'radios', title => t('Access type'), default_value => $edit['status'], options => array('1' => t('Allow'), '0' => t('Deny')));
- $form['type'] = array(type => 'radios', title => t('Rule type'), default_value => $edit['type'], options => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'), default_value => 'host'));
- $form['mask'] = array(type => 'textfield', title => t('Mask'), default_value => $edit['mask'], size => 30, maxlength => 64, description => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), required => TRUE);
+ $form['status'] = array('#type' => 'radios', '#title' => t('Access type'), '#default_value' => $edit['status'], '#options' => array('1' => t('Allow'), '0' => t('Deny')));
+ $form['type'] = array('#type' => 'radios', '#title' => t('Rule type'), '#default_value' => $edit['type'], '#options' => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'), '#default_value' => 'host'));
+ $form['mask'] = array('#type' => 'textfield', '#title' => t('Mask'), '#default_value' => $edit['mask'], '#size' => 30, '#maxlength' => 64, '#description' => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), '#required' => TRUE);
return $form;
}
@@ -1575,11 +1575,11 @@ function user_admin_perm() {
$options = array();
foreach (module_list() as $module) {
if ($permissions = module_invoke($module, 'perm')) {
- $form['permission'][] = array(type => 'markup', value => t('%module module', array('%module' => $module)));
+ $form['permission'][] = array('#type' => 'markup', '#value' => t('%module module', array('%module' => $module)));
asort($permissions);
foreach ($permissions as $perm) {
$options[$perm] = '';
- $form['permission'][$perm] = array(type => 'markup', value => t($perm));
+ $form['permission'][$perm] = array('#type' => 'markup', '#value' => t($perm));
foreach ($role_names as $rid => $name) {
// Builds arrays for checked boxes for each role
if (strstr($role_permissions[$rid], $perm)) {
@@ -1591,10 +1591,10 @@ function user_admin_perm() {
}
// Have to build checkboxes here after checkbox arrays are built
foreach ($role_names as $rid => $name) {
- $form['checkboxes'][$rid] = array(type => 'checkboxes', options => $options, default_value => $status[$rid], tree => TRUE);
- $form['role_names'][$rid] = array(type => 'markup', value => $name, tree => TRUE);
+ $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status[$rid], '#tree' => TRUE);
+ $form['role_names'][$rid] = array('#type' => 'markup', '#value' => $name, '#tree' => TRUE);
}
- $form['submit'] = array(type => 'submit', value => t('Save permissions'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
return drupal_get_form('user_admin_perm', $form);
}
@@ -1708,13 +1708,13 @@ function user_admin_role() {
else if ($id) {
// Display the role form.
$role = db_fetch_object(db_query('SELECT * FROM {role} WHERE rid = %d', $id));
- $form['name'] = array(type => 'textfield', title => t('Role name'), default_value => $role->name, size => 30, maxlength => 64, description => t('The name for this role. Example: "moderator", "editorial board", "site architect".'));
- $form['submit'] = array(type => 'submit', value => t('Save role'));
- $form['delete'] = array(type => 'submit', value => t('Delete role'));
+ $form['name'] = array('#type' => 'textfield', '#title' => t('Role name'), '#default_value' => $role->name, '#size' => 30, '#maxlength' => 64, '#description' => t('The name for this role. Example: "moderator", "editorial board", "site architect".'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save role'));
+ $form['delete'] = array('#type' => 'submit', '#value' => t('Delete role'));
return drupal_get_form('user_admin_role', $form);
}
- $form['name'] = array(type => 'textfield', size => 32, maxlength => 64);
- $form['submit'] = array(type => 'submit', value => t('Add role'));
+ $form['name'] = array('#type' => 'textfield', '#size' => 32, '#maxlength' => 64);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Add role'));
return drupal_get_form('user_admin_new_role', $form);
}
@@ -1765,18 +1765,18 @@ function user_admin_account() {
function user_configure() {
// User registration settings.
- $form['registration'] = array(type => 'fieldset', title => t('User registration settings'));
- $form['registration']['user_register'] = array(type => 'radios', title => t('Public registrations'), default_value => variable_get('user_register', 1), options => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
- $form['registration']['user_registration_help'] = array(type => 'textarea', title => t('User registration guidelines'), default_value => variable_get('user_registration_help', ''), cols => 60, rows => 5, description => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.'));
+ $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
+ $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
+ $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#cols' => 60, '#rows' => 5, '#description' => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.'));
// User e-mail settings.
- $form['email'] = array(type => 'fieldset', title => t('User email settings'));
- $form['email']['user_mail_welcome_subject'] = array(type => 'textfield', title => t('Subject of welcome e-mail'), default_value => _user_mail_text('welcome_subject'), size => 60, maxlength => 180, description => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_welcome_body'] = array(type => 'textarea', title => t('Body of welcome e-mail'), default_value => _user_mail_text('welcome_body'), cols => 60, rows => 15, description => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_approval_subject'] = array(type => 'textfield', title => t('Subject of welcome e-mail (awaiting admin approval)'), default_value => _user_mail_text('approval_subject'), size => 60, maxlength => 180, description => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_approval_body'] = array(type => 'textarea', title => t('Body of welcome e-mail (awaiting admin approval)'), default_value => _user_mail_text('approval_body'), cols => 60, rows => 15, description => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
- $form['email']['user_mail_pass_subject'] = array(type => 'textfield', title => t('Subject of password recovery e-mail'), default_value => _user_mail_text('pass_subject'), size => 60, maxlength => 180, description => t('Customize the Subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri.');
- $form['email']['user_mail_pass_body'] = array(type => 'textarea', title => t('Body of password recovery e-mail'), default_value => _user_mail_text('pass_body'), cols => 60, rows => 15, description => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %login_uri, %edit_uri.');
+ $form['email'] = array('#type' => 'fieldset', '#title' => t('User email settings'));
+ $form['email']['user_mail_welcome_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail'), '#default_value' => _user_mail_text('welcome_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_welcome_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail'), '#default_value' => _user_mail_text('welcome_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_approval_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_approval_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
+ $form['email']['user_mail_pass_subject'] = array('#type' => 'textfield', '#title' => t('Subject of password recovery e-mail'), '#default_value' => _user_mail_text('pass_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the Subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri.');
+ $form['email']['user_mail_pass_body'] = array('#type' => 'textarea', '#title' => t('Body of password recovery e-mail'), '#default_value' => _user_mail_text('pass_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %login_uri, %edit_uri.');
// If picture support is enabled, check whether the picture directory exists:
if (variable_get('user_pictures', 0)) {
@@ -1784,13 +1784,13 @@ function user_configure() {
file_check_directory($picture_path, 1, 'user_picture_path');
}
- $form['pictures'] = array(type => 'fieldset', title => t('Pictures'));
- $form['pictures']['user_pictures'] = array(type => 'radios', title => t('Picture support'), default_value => variable_get('user_pictures', 0), options => array(t('Disabled'), t('Enabled')), description => t('Enable picture support.'));
- $form['pictures']['user_picture_path'] = array(type => 'textfield', title => t('Picture image path'), default_value => variable_get('user_picture_path', 'pictures'), size => 30, maxlength => 255, description => t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/')));
- $form['pictures']['user_picture_default'] = array(type => 'textfield', title => t('Default picture'), default_value => variable_get('user_picture_default', ''), size => 30, maxlength => 255, description => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
- $form['pictures']['user_picture_dimensions'] = array(type => 'textfield', title => t('Picture maximum dimensions'), default_value => variable_get('user_picture_dimensions', '85x85'), size => 15, maxlength => 10, description => t('Maximum dimensions for pictures.'));
- $form['pictures']['user_picture_file_size'] = array(type => 'textfield', title => t('Picture maximum file size'), default_value => variable_get('user_picture_file_size', '30'), size => 15, maxlength => 10, description => t('Maximum file size for pictures, in kB.'));
- $form['pictures']['user_picture_guidelines'] = array(type => 'textarea', title => t('Picture guidelines'), default_value => variable_get('user_picture_guidelines', ''), cols => 60, rows => 5, description => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.'));
+ $form['pictures'] = array('#type' => 'fieldset', '#title' => t('Pictures'));
+ $form['pictures']['user_pictures'] = array('#type' => 'radios', '#title' => t('Picture support'), '#default_value' => variable_get('user_pictures', 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable picture support.'));
+ $form['pictures']['user_picture_path'] = array('#type' => 'textfield', '#title' => t('Picture image path'), '#default_value' => variable_get('user_picture_path', 'pictures'), '#size' => 30, '#maxlength' => 255, '#description' => t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/')));
+ $form['pictures']['user_picture_default'] = array('#type' => 'textfield', '#title' => t('Default picture'), '#default_value' => variable_get('user_picture_default', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
+ $form['pictures']['user_picture_dimensions'] = array('#type' => 'textfield', '#title' => t('Picture maximum dimensions'), '#default_value' => variable_get('user_picture_dimensions', '85x85'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum dimensions for pictures.'));
+ $form['pictures']['user_picture_file_size'] = array('#type' => 'textfield', '#title' => t('Picture maximum file size'), '#default_value' => variable_get('user_picture_file_size', '30'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum file size for pictures, in kB.'));
+ $form['pictures']['user_picture_guidelines'] = array('#type' => 'textarea', '#title' => t('Picture guidelines'), '#default_value' => variable_get('user_picture_guidelines', ''), '#cols' => 60, '#rows' => 5, '#description' => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.'));
return system_settings_form('user_configure_settings', $form);
}
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 22c1ad0f3..1ffd7376c 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -82,13 +82,13 @@ function watchdog_overview() {
}
$form['filter'] = array(
- type => 'select',
- title => t('Filter by message type'),
- options => $names,
- default_value => $_SESSION['watchdog_overview_filter']
+ '#type' => 'select',
+ '#title' => t('Filter by message type'),
+ '#options' => $names,
+ '#default_value' => $_SESSION['watchdog_overview_filter']
);
- $form['submit'] = array(type => 'submit', value =>t('Filter'));
+ $form['submit'] = array('#type' => 'submit', '#value' =>t('Filter'));
$output = drupal_get_form('watchdog_form_overview', $form);
$header = array(
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 22c1ad0f3..1ffd7376c 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -82,13 +82,13 @@ function watchdog_overview() {
}
$form['filter'] = array(
- type => 'select',
- title => t('Filter by message type'),
- options => $names,
- default_value => $_SESSION['watchdog_overview_filter']
+ '#type' => 'select',
+ '#title' => t('Filter by message type'),
+ '#options' => $names,
+ '#default_value' => $_SESSION['watchdog_overview_filter']
);
- $form['submit'] = array(type => 'submit', value =>t('Filter'));
+ $form['submit'] = array('#type' => 'submit', '#value' =>t('Filter'));
$output = drupal_get_form('watchdog_form_overview', $form);
$header = array(