Commit aeed4cd8 authored by Dries's avatar Dries

- Patch #35644 by webchick: forms API simplificiations.

parent 64a617c2
...@@ -100,7 +100,7 @@ function _locale_admin_manage_add_screen() { ...@@ -100,7 +100,7 @@ function _locale_admin_manage_add_screen() {
$form = array(); $form = array();
$form['header'] = array('#prefix' => '<h2>', '#value' => t('Custom language') , '#suffix' => '</h2>'); $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['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['langname'] = array('#type' => 'textfield', '#title' => t('Language name in English'), '#default_value' => $edit['langname'], '#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['submit'] = array('#type' => 'submit', '#value' => t('Add custom language'));
$output .= drupal_get_form('_locale_custom_language', $form); $output .= drupal_get_form('_locale_custom_language', $form);
...@@ -980,15 +980,15 @@ function _locale_string_edit($lid) { ...@@ -980,15 +980,15 @@ function _locale_string_edit($lid) {
while ($translation = db_fetch_object($result)) { while ($translation = db_fetch_object($result)) {
$orig = $translation->source; $orig = $translation->source;
$form[$translation->locale] = (strlen($orig) > 40) ? $form[$translation->locale] = (strlen($orig) > 40) ?
array('#type' => 'textarea', '#title' => $languages['name'][$translation->locale], '#default_value' => $translation->translation, '#cols' => 60, '#rows' => 15) array('#type' => 'textarea', '#title' => $languages['name'][$translation->locale], '#default_value' => $translation->translation, '#rows' => 15)
: array('#type' => 'textfield', '#title' => $languages['name'][$translation->locale], '#default_value' => $translation->translation, '#size' => 60, '#maxlength' => 128); : array('#type' => 'textfield', '#title' => $languages['name'][$translation->locale], '#default_value' => $translation->translation);
unset($languages['name'][$translation->locale]); unset($languages['name'][$translation->locale]);
} }
$form['item'] = array('#type' => 'item', '#title' => t('Original text'), '#value' => wordwrap(check_plain($orig, 0))); $form['item'] = array('#type' => 'item', '#title' => t('Original text'), '#value' => wordwrap(check_plain($orig, 0)));
foreach ($languages['name'] as $key => $lang) { foreach ($languages['name'] as $key => $lang) {
$form[$key] = (strlen($orig) > 40) ? $form[$key] = (strlen($orig) > 40) ?
array('#type' => 'textarea', '#title' => $lang, '#cols' => 60, '#rows' => 15) : array('#type' => 'textarea', '#title' => $lang, '#rows' => 15) :
array('#type' => 'textfield', '#title' => $lang, '#size' => 60, '#maxlength' => 128); array('#type' => 'textfield', '#title' => $lang);
} }
$form['submit'] = array('#type' => 'submit', '#value' => t('Save translations')); $form['submit'] = array('#type' => 'submit', '#value' => t('Save translations'));
......
...@@ -645,8 +645,8 @@ function aggregator_save_item($edit) { ...@@ -645,8 +645,8 @@ function aggregator_save_item($edit) {
} }
function aggregator_form_category($edit = array()) { function aggregator_form_category($edit = array()) {
$form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64); $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#maxlength' => 64);
$form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5); $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description']);
$form['submit'] = array('#type' => 'submit', '#value' =>t('Submit')); $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
if ($edit['cid']) { if ($edit['cid']) {
...@@ -679,8 +679,8 @@ function aggregator_form_feed($edit = array()) { ...@@ -679,8 +679,8 @@ 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['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#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['url'] = array('#type' => 'textfield', '#title' => t('URL'), '#default_value' => $edit['url'], '#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['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: // Handling of categories:
......
...@@ -645,8 +645,8 @@ function aggregator_save_item($edit) { ...@@ -645,8 +645,8 @@ function aggregator_save_item($edit) {
} }
function aggregator_form_category($edit = array()) { function aggregator_form_category($edit = array()) {
$form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#size' => 60, '#maxlength' => 64); $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#maxlength' => 64);
$form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#cols' => 60, '#rows' => 5); $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description']);
$form['submit'] = array('#type' => 'submit', '#value' =>t('Submit')); $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
if ($edit['cid']) { if ($edit['cid']) {
...@@ -679,8 +679,8 @@ function aggregator_form_feed($edit = array()) { ...@@ -679,8 +679,8 @@ 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['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#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['url'] = array('#type' => 'textfield', '#title' => t('URL'), '#default_value' => $edit['url'], '#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['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: // Handling of categories:
......
...@@ -334,7 +334,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -334,7 +334,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form['block_settings'] = array('#type' => 'fieldset', $form['block_settings'] = array('#type' => 'fieldset',
'#title' => t('Block specific settings'), '#title' => t('Block specific settings'),
'#collapsible' => true, '#collapsible' => true,
'#collapsed' => false,
'#weight' => 0); '#weight' => 0);
foreach ($settings as $k => $v) { foreach ($settings as $k => $v) {
...@@ -351,7 +350,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -351,7 +350,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form['user_vis_settings'] = array('#type' => 'fieldset', $form['user_vis_settings'] = array('#type' => 'fieldset',
'#title' => t('User specific visibility settings'), '#title' => t('User specific visibility settings'),
'#collapsible' => true, '#collapsible' => true,
'#collapsed' => false,
'#weight' => 0); '#weight' => 0);
$form['user_vis_settings']['custom'] = array( $form['user_vis_settings']['custom'] = array(
...@@ -365,7 +363,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -365,7 +363,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form['page_vis_settings'] = array('#type' => 'fieldset', $form['page_vis_settings'] = array('#type' => 'fieldset',
'#title' => t('Page specific visibility settings'), '#title' => t('Page specific visibility settings'),
'#collapsible' => true, '#collapsible' => true,
'#collapsed' => false,
'#weight' => 0); '#weight' => 0);
...@@ -380,8 +377,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -380,8 +377,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Pages'), '#title' => t('Pages'),
'#default_value' => $edit['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 ?>')))); '#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'));
...@@ -436,10 +431,10 @@ function block_box_delete_confirm_execute($form_id, $edit) { ...@@ -436,10 +431,10 @@ function block_box_delete_confirm_execute($form_id, $edit) {
function block_box_form($edit = array()) { 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'], '#maxlength' => 64, '#description' => t('The title of the block as shown to the user.'));
$form['format'] = filter_form($edit['format']); $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['body'] = array('#type' => 'textarea', '#title' => t('Block body'), '#default_value' => $edit['body'], '#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['info'] = array('#type' => 'textfield', '#title' => t('Block description'), '#default_value' => $edit['info'], '#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; return $form;
} }
...@@ -489,7 +484,7 @@ function block_user($type, $edit, &$user, $category = NULL) { ...@@ -489,7 +484,7 @@ function block_user($type, $edit, &$user, $category = NULL) {
case 'form': case 'form':
if ($category == 'account') { if ($category == 'account') {
$result = db_query('SELECT * FROM {blocks} WHERE status = 1 AND custom != 0 ORDER BY weight, module, delta'); $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, '#tree' => TRUE);
while ($block = db_fetch_object($result)) { while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, 'block', 'list'); $data = module_invoke($block->module, 'block', 'list');
if ($data[$block->delta]['info']) { if ($data[$block->delta]['info']) {
......
...@@ -334,7 +334,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -334,7 +334,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form['block_settings'] = array('#type' => 'fieldset', $form['block_settings'] = array('#type' => 'fieldset',
'#title' => t('Block specific settings'), '#title' => t('Block specific settings'),
'#collapsible' => true, '#collapsible' => true,
'#collapsed' => false,
'#weight' => 0); '#weight' => 0);
foreach ($settings as $k => $v) { foreach ($settings as $k => $v) {
...@@ -351,7 +350,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -351,7 +350,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form['user_vis_settings'] = array('#type' => 'fieldset', $form['user_vis_settings'] = array('#type' => 'fieldset',
'#title' => t('User specific visibility settings'), '#title' => t('User specific visibility settings'),
'#collapsible' => true, '#collapsible' => true,
'#collapsed' => false,
'#weight' => 0); '#weight' => 0);
$form['user_vis_settings']['custom'] = array( $form['user_vis_settings']['custom'] = array(
...@@ -365,7 +363,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -365,7 +363,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form['page_vis_settings'] = array('#type' => 'fieldset', $form['page_vis_settings'] = array('#type' => 'fieldset',
'#title' => t('Page specific visibility settings'), '#title' => t('Page specific visibility settings'),
'#collapsible' => true, '#collapsible' => true,
'#collapsed' => false,
'#weight' => 0); '#weight' => 0);
...@@ -380,8 +377,6 @@ function block_admin_configure($module = NULL, $delta = 0) { ...@@ -380,8 +377,6 @@ function block_admin_configure($module = NULL, $delta = 0) {
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Pages'), '#title' => t('Pages'),
'#default_value' => $edit['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 ?>')))); '#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'));
...@@ -436,10 +431,10 @@ function block_box_delete_confirm_execute($form_id, $edit) { ...@@ -436,10 +431,10 @@ function block_box_delete_confirm_execute($form_id, $edit) {
function block_box_form($edit = array()) { 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'], '#maxlength' => 64, '#description' => t('The title of the block as shown to the user.'));
$form['format'] = filter_form($edit['format']); $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['body'] = array('#type' => 'textarea', '#title' => t('Block body'), '#default_value' => $edit['body'], '#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['info'] = array('#type' => 'textfield', '#title' => t('Block description'), '#default_value' => $edit['info'], '#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; return $form;
} }
...@@ -489,7 +484,7 @@ function block_user($type, $edit, &$user, $category = NULL) { ...@@ -489,7 +484,7 @@ function block_user($type, $edit, &$user, $category = NULL) {
case 'form': case 'form':
if ($category == 'account') { if ($category == 'account') {
$result = db_query('SELECT * FROM {blocks} WHERE status = 1 AND custom != 0 ORDER BY weight, module, delta'); $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, '#tree' => TRUE);
while ($block = db_fetch_object($result)) { while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, 'block', 'list'); $data = module_invoke($block->module, 'block', 'list');
if ($data[$block->delta]['info']) { if ($data[$block->delta]['info']) {
......
...@@ -228,7 +228,7 @@ function blog_form(&$node) { ...@@ -228,7 +228,7 @@ function blog_form(&$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'), '#required' => TRUE, '#default_value' => $node->title);
$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)); $form = array_merge($form, filter_form($node->format));
return $form; return $form;
......
...@@ -228,7 +228,7 @@ function blog_form(&$node) { ...@@ -228,7 +228,7 @@ function blog_form(&$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'), '#required' => TRUE, '#default_value' => $node->title);
$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)); $form = array_merge($form, filter_form($node->format));
return $form; return $form;
......
...@@ -247,7 +247,7 @@ function book_form(&$node) { ...@@ -247,7 +247,7 @@ function book_form(&$node) {
'#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.') '#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.')
); );
$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'), '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array( $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
); );
...@@ -257,7 +257,7 @@ function book_form(&$node) { ...@@ -257,7 +257,7 @@ function book_form(&$node) {
'#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE '#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE
); );
$form['log']['message'] = array( $form['log']['message'] = array(
'#type' => 'textarea', '#default_value' => $node->log, '#rows' => 5, '#weight' => 18, '#type' => 'textarea', '#default_value' => $node->log, '#weight' => 18,
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.') '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
); );
...@@ -322,7 +322,7 @@ function book_outline() { ...@@ -322,7 +322,7 @@ function book_outline() {
); );
$form['log'] = array( $form['log'] = array(
'#type' => 'textarea', '#title' => t('Log message'), '#cols' => 60, '#rows' => 5, '#type' => 'textarea', '#title' => t('Log message'),
'#default_value' => $node->log, '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.') '#default_value' => $node->log, '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.')
); );
...@@ -986,7 +986,7 @@ function book_node_visitor_opml_post($node, $depth) { ...@@ -986,7 +986,7 @@ function book_node_visitor_opml_post($node, $depth) {
*/ */
function book_admin_edit_line($node, $depth = 0) { function book_admin_edit_line($node, $depth = 0) {
$form['#tree'] = TRUE; $form['#tree'] = TRUE;
$form[$node->nid]['title'] = array('#type' => 'textfield', '#default_value' => $node->title, '#size' => 60, '#maxlength' => 255); $form[$node->nid]['title'] = array('#type' => 'textfield', '#default_value' => $node->title, '#maxlength' => 255);
$form[$node->nid]['weight'] = array('#type' => 'weight', '#default_value' => $node->weight, '#delta' => 15); $form[$node->nid]['weight'] = array('#type' => 'weight', '#default_value' => $node->weight, '#delta' => 15);
$form['depth'] = array('#value' => $depth); $form['depth'] = array('#value' => $depth);
$form['nid'] = array('#value' => $node->nid); $form['nid'] = array('#value' => $node->nid);
......
...@@ -247,7 +247,7 @@ function book_form(&$node) { ...@@ -247,7 +247,7 @@ function book_form(&$node) {
'#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.') '#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.')
); );
$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'), '#required' => TRUE, '#default_value' => $node->title);
$form['body'] = array( $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
); );
...@@ -257,7 +257,7 @@ function book_form(&$node) { ...@@ -257,7 +257,7 @@ function book_form(&$node) {
'#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE '#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE
); );
$form['log']['message'] = array( $form['log']['message'] = array(
'#type' => 'textarea', '#default_value' => $node->log, '#rows' => 5, '#weight' => 18, '#type' => 'textarea', '#default_value' => $node->log, '#weight' => 18,
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.') '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
); );
...@@ -322,7 +322,7 @@ function book_outline() { ...@@ -322,7 +322,7 @@ function book_outline() {
); );
$form['log'] = array( $form['log'] = array(
'#type' => 'textarea', '#title' => t('Log message'), '#cols' => 60, '#rows' => 5, '#type' => 'textarea', '#title' => t('Log message'),
'#default_value' => $node->log, '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.') '#default_value' => $node->log, '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.')
); );
...@@ -986,7 +986,7 @@ function book_node_visitor_opml_post($node, $depth) { ...@@ -986,7 +986,7 @@ function book_node_visitor_opml_post($node, $depth) {
*/ */
function book_admin_edit_line($node, $depth = 0) { function book_admin_edit_line($node, $depth = 0) {
$form['#tree'] = TRUE; $form['#tree'] = TRUE;
$form[$node->nid]['title'] = array('#type' => 'textfield', '#default_value' => $node->title, '#size' => 60, '#maxlength' => 255); $form[$node->nid]['title'] = array('#type' => 'textfield', '#default_value' => $node->title, '#maxlength' => 255);
$form[$node->nid]['weight'] = array('#type' => 'weight', '#default_value' => $node->weight, '#delta' => 15); $form[$node->nid]['weight'] = array('#type' => 'weight', '#default_value' => $node->weight, '#delta' => 15);
$form['depth'] = array('#value' => $depth); $form['depth'] = array('#value' => $depth);
$form['nid'] = array('#value' => $node->nid); $form['nid'] = array('#value' => $node->nid);
......
...@@ -249,8 +249,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) { ...@@ -249,8 +249,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
function comment_user($type, $edit, &$user, $category = NULL) { function comment_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') { if ($type == 'form' && $category == 'account') {
// when user tries to edit his own data // 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'] = array('#type' => 'fieldset', '#title' => t('Comment settings'), '#collapsible' => TRUE, '#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']['signature'] = array('#type' => 'textarea', '#title' => t('Signature'), '#default_value' => $edit['comment_settings']['signature'], '#description' => ('Your signature will be publicly displayed at the end of your comments.'));
return $form; return $form;
} }
...@@ -1108,10 +1108,10 @@ function comment_form($edit, $title = NULL) { ...@@ -1108,10 +1108,10 @@ function comment_form($edit, $title = NULL) {
} }
if (variable_get('comment_subject_field', 1) == 1) { 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'), '#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'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE
); );
$form = array_merge($form, filter_form($node->format)); $form = array_merge($form, filter_form($node->format));
......
...@@ -249,8 +249,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) { ...@@ -249,8 +249,8 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
function comment_user($type, $edit, &$user, $category = NULL) { function comment_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') { if ($type == 'form' && $category == 'account') {
// when user tries to edit his own data // 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'] = array('#type' => 'fieldset', '#title' => t('Comment settings'), '#collapsible' => TRUE, '#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']['signature'] = array('#type' => 'textarea', '#title' => t('Signature'), '#default_value' => $edit['comment_settings']['signature'], '#description' => ('Your signature will be publicly displayed at the end of your comments.'));
return $form; return $form;
} }
...@@ -1108,10 +1108,10 @@ function comment_form($edit, $title = NULL) { ...@@ -1108,10 +1108,10 @@ function comment_form($edit, $title = NULL) {
} }
if (variable_get('comment_subject_field', 1) == 1) { 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'), '#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'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE
); );
$form = array_merge($form, filter_form($node->format)); $form = array_merge($form, filter_form($node->format));
......
...@@ -70,7 +70,7 @@ function contact_menu($may_cache) { ...@@ -70,7 +70,7 @@ function contact_menu($may_cache) {
*/ */
function contact_settings() { function contact_settings() {
$form['contact_form_information'] = array( $form['contact_form_information'] = array(
'#type' => 'textarea', '#title' => t('Additional information'), '#cols' => 60, '#rows' => 5, '#type' => 'textarea', '#title' => t('Additional information'),
'#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')), '#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'))) '#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')))
); );
...@@ -84,8 +84,8 @@ function contact_settings() { ...@@ -84,8 +84,8 @@ function contact_settings() {
*/ */
function contact_user($type, $edit, &$user, $category = NULL) { function contact_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') { if ($type == 'form' && $category == 'account') {
$form['contact'] = array('#type' => 'fieldset', '#title' => t('Contact settings'), '#weight' => 5, '#collapsible' => TRUE, '#collapsed' => FALSE); $form['contact'] = array('#type' => 'fieldset', '#title' => t('Contact settings'), '#weight' => 5, '#collapsible' => TRUE);
$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']['contact'] = array('#type' => 'checkbox', '#title' => t('Personal contact form'), '#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 $form;
//return array(array('title' => t('Contact settings'), 'data' => drupal_get_form('contact_user', $form), 'weight' => 2)); //return array(array('title' => t('Contact settings'), 'data' => drupal_get_form('contact_user', $form), 'weight' => 2));
} }
...@@ -116,8 +116,8 @@ function contact_mail_user() { ...@@ -116,8 +116,8 @@ function contact_mail_user() {
$form['#token'] = $user->name . $user->mail; $form['#token'] = $user->name . $user->mail;
$form['from'] = array('#type' => 'item', '#title' => t('From'), '#value' => $user->name .' &lt;'. $user->mail .'&gt;'); $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['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['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 50, '#required' => TRUE);
$form['message'] = array('#type' => 'textarea', '#title' => t('Message'), '#cols' => 60, '#rows' => 15, '#required' => TRUE); $form['message'] = array('#type' => 'textarea', '#title' => t('Message'), '#rows' => 15, '#required' => TRUE);
$form['copy'] = array('#type' => 'checkbox', '#title' => ('Send me a copy.')); $form['copy'] = array('#type' => 'checkbox', '#title' => ('Send me a copy.'));
$form['submit'] = array('#type' => 'submit', '#value' => t('Send e-mail')); $form['submit'] = array('#type' => 'submit', '#value' => t('Send e-mail'));
$output = drupal_get_form('contact_user_mail', $form); $output = drupal_get_form('contact_user_mail', $form);
...@@ -200,9 +200,9 @@ function contact_admin_edit($cid = NULL) { ...@@ -200,9 +200,9 @@ function contact_admin_edit($cid = NULL) {
$edit['reply'] = $category->reply; $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['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#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['recipients'] = array('#type' => 'textarea', '#title' => t('Recipients'), '#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['reply'] = array('#type' => 'textarea', '#title' => t('Auto-reply'), '#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['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
return drupal_get_form('contact_admin_edit', $form); return drupal_get_form('contact_admin_edit', $form);
...@@ -256,14 +256,14 @@ function contact_mail_page() { ...@@ -256,14 +256,14 @@ function contact_mail_page() {
if (count($categories) > 1) { if (count($categories) > 1) {
$form['#token'] = $user->name . $user->mail; $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['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['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#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['mail'] = array('#type' => 'textfield', '#title' => t('Your e-mail address'), '#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['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 255, '#default_value' => $edit['subject'], '#required' => TRUE);
if (count($categories) > 2) {