Commit cb8be5f8 authored by Dries's avatar Dries

- Patch #89285 by profix: code simplifications.

parent 13232aba
......@@ -168,7 +168,6 @@ function install_settings_form($profile, $install_locale, $settings_file, $db_ur
$db_types = drupal_detect_database_types();
if (count($db_types) == 0) {
$form['no_db_types'] = array(
'#type' => 'markup',
'#value' => st('Your web server does not appear to support any common database types. Check with your hosting provider to see if they offer any databases that <a href="@drupal-databases">Drupal supports</a>.', array('@drupal-databases' => 'http://drupal.org/node/270#database')),
);
}
......
......@@ -842,10 +842,7 @@ function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents =
'#value' => theme('filter_tips', $tips, FALSE, $extra),
);
}
$form[] = array(
'#type' => 'markup',
'#value' => $extra,
);
$form[] = array('#value' => $extra);
return $form;
}
......
......@@ -783,7 +783,7 @@ function node_search($op = 'search', $keys = NULL) {
// Output form for defining rank factor weights.
$form['content_ranking'] = array('#type' => 'fieldset', '#title' => t('Content ranking'));
$form['content_ranking']['#theme'] = 'node_search_admin';
$form['content_ranking']['info'] = array('#type' => 'markup', '#value' => '<em>'. t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') .'</em>');
$form['content_ranking']['info'] = array('#value' => '<em>'. t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') .'</em>');
$ranking = array('node_rank_relevance' => t('Keyword relevance'),
'node_rank_recent' => t('Recently posted'));
......
......@@ -229,7 +229,7 @@ function search_admin_settings() {
$percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
$status = '<p><strong>'. t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) .' '. $count .'</strong></p>';
$form['status'] = array('#type' => 'fieldset', '#title' => t('Indexing status'));
$form['status']['status'] = array('#type' => 'markup', '#value' => $status);
$form['status']['status'] = array('#value' => $status);
$form['status']['wipe'] = array('#type' => 'submit', '#value' => t('Re-index site'));
$items = drupal_map_assoc(array(10, 20, 50, 100, 200, 500));
......@@ -239,7 +239,7 @@ function search_admin_settings() {
$form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Items to index per cron run'), '#default_value' => variable_get('search_cron_limit', 100), '#options' => $items, '#description' => t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'));
// Indexing settings:
$form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings'));
$form['indexing_settings']['info'] = array('#type' => 'markup', '#value' => '<em>'. t('<p>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
$form['indexing_settings']['info'] = array('#value' => '<em>'. t('<p>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
$form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'));
$form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get('overlap_cjk', TRUE), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.'));
......
......@@ -498,7 +498,7 @@ function system_theme_select_form($description = '', $default_value = '', $weigh
$info->screenshot = dirname($info->filename) . '/screenshot.png';
$screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), FALSE) : t('no screenshot');
$form['themes'][$info->key]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
$form['themes'][$info->key]['screenshot'] = array('#value' => $screenshot);
$form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'bluemarine') ? t('<br /> <em>(site default theme)</em>') : ''));
$options[$info->key] = '';
}
......@@ -1122,14 +1122,14 @@ function system_themes() {
$info->screenshot = dirname($info->filename) . '/screenshot.png';
$screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), FALSE) : t('no screenshot');
$form[$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
$form[$info->name]['screenshot'] = array('#value' => $screenshot);
$form[$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename));
$options[$info->name] = '';
if ($info->status) {
$status[] = $info->name;
}
if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
$form[$info->name]['operations'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/build/themes/settings/' . $info->name) );
$form[$info->name]['operations'] = array('#value' => l(t('configure'), 'admin/build/themes/settings/' . $info->name) );
}
else {
// Dummy element for drupal_render. Cleaner than adding a check in the theme function.
......
......@@ -768,7 +768,7 @@ function _upload_form($node) {
$description = "<small>". check_plain($description) ."</small>";
$form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => (strlen($file->description)) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description );
$form['files'][$key]['size'] = array('#type' => 'markup', '#value' => format_size($file->filesize));
$form['files'][$key]['size'] = array('#value' => format_size($file->filesize));
$form['files'][$key]['remove'] = array('#type' => 'checkbox', '#default_value' => $file->remove);
$form['files'][$key]['list'] = array('#type' => 'checkbox', '#default_value' => $file->list);
// if the file was uploaded this page request, set value. this fixes the problem
......
......@@ -1156,12 +1156,12 @@ function user_register() {
// Display the registration form.
if (!$admin) {
$form['user_registration_help'] = array('#type' => 'markup', '#value' => filter_xss_admin(variable_get('user_registration_help', '')));
$form['user_registration_help'] = array('#value' => filter_xss_admin(variable_get('user_registration_help', '')));
}
$affiliates = user_auth_help_links();
if (!$admin && count($affiliates) > 0) {
$affiliates = implode(', ', $affiliates);
$form['affiliates'] = array('#type' => 'markup', '#value' => '<p>'. t('Note: if you have an account with one of our affiliates (!s), you may <a href="@login_uri">login now</a> instead of registering.', array('!s' => $affiliates, '@login_uri' => url('user'))) .'</p>');
$form['affiliates'] = array('#value' => '<p>'. t('Note: if you have an account with one of our affiliates (!s), you may <a href="@login_uri">login now</a> instead of registering.', array('!s' => $affiliates, '@login_uri' => url('user'))) .'</p>');
}
// Merge in the default user edit fields.
$form = array_merge($form, user_edit_form(NULL, NULL, TRUE));
......@@ -1327,7 +1327,7 @@ function user_edit_form($uid, $edit, $register = FALSE) {
$form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1);
$picture = theme('user_picture', (object)$edit);
if ($picture) {
$form['picture']['current_picture'] = array('#type' => 'markup', '#value' => $picture);
$form['picture']['current_picture'] = array('#value' => $picture);
$form['picture']['picture_delete'] = array('#type' => 'checkbox', '#title' => t('Delete picture'), '#description' => t('Check this box to delete your current picture.'));
} else {
$form['picture']['picture_delete'] = array('#type' => 'hidden');
......@@ -1784,11 +1784,11 @@ function user_admin_perm($rid = NULL) {
$options = array();
foreach (module_list(FALSE, FALSE, TRUE) as $module) {
if ($permissions = module_invoke($module, 'perm')) {
$form['permission'][] = array('#type' => 'markup', '#value' => t('@module module', array('@module' => $module)));
$form['permission'][] = array('#value' => t('@module module', array('@module' => $module)));
asort($permissions);
foreach ($permissions as $perm) {
$options[$perm] = '';
$form['permission'][$perm] = array('#type' => 'markup', '#value' => t($perm));
$form['permission'][$perm] = array('#value' => t($perm));
foreach ($role_names as $rid => $name) {
// Builds arrays for checked boxes for each role
if (strstr($role_permissions[$rid], $perm)) {
......@@ -1802,7 +1802,7 @@ function user_admin_perm($rid = NULL) {
// Have to build checkboxes here after checkbox arrays are built
foreach ($role_names as $rid => $name) {
$form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status[$rid]);
$form['role_names'][$rid] = array('#type' => 'markup', '#value' => $name, '#tree' => TRUE);
$form['role_names'][$rid] = array('#value' => $name, '#tree' => TRUE);
}
$form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment