Commit 75fe6b6c authored by Dries's avatar Dries
Browse files

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

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