Commit 75fe6b6c authored by Dries's avatar Dries

- Patch #33752 by chx, adrian, et al: another batch of form API changes/fixes.

parent ecf5ed57
This diff is collapsed.
This diff is collapsed.
......@@ -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;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -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 {
......
......@@ -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 {
......
......@@ -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')),