summaryrefslogtreecommitdiff
path: root/modules/drupal.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-07-04 16:50:02 +0000
committerDries Buytaert <dries@buytaert.net>2004-07-04 16:50:02 +0000
commitfe2b3e7c006a607c2b9fd9a485a7bda13515a94f (patch)
tree1c16960253df2c99488fdd8cf81305ff369884d4 /modules/drupal.module
parent353c05d01536aac26fec7e9cfee0e84838973286 (diff)
downloadbrdo-fe2b3e7c006a607c2b9fd9a485a7bda13515a94f.tar.gz
brdo-fe2b3e7c006a607c2b9fd9a485a7bda13515a94f.tar.bz2
- Patch by Steven and me: refactored the form handling of nodes. The node system is now using form_set_error() and friends like the rest of Drupal does. This makes for both a consistent user experience and consistent code. It simplifies the forms and validation code, however, it does change the node API slightly:
* The _validate hook and the _nodeapi('validate') hook of the node API (1) no longer take an 'error' parameter and (2) should no longer return an error array. To set an error, call form_set_error(). * The _form hook of the node module no longer takes a form hook and should not worry about displaying errors. Ditto for _nodeapi('form_post') and _nodeapi('form_pre').
Diffstat (limited to 'modules/drupal.module')
-rw-r--r--modules/drupal.module10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/drupal.module b/modules/drupal.module
index 9291f79ef..381192a86 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -29,16 +29,16 @@ function drupal_help($section) {
function drupal_settings() {
// Check if all required fields are present for the Drupal directory
if ((variable_get('site_name', 'drupal') == 'drupal') || (variable_get('site_name', 'drupal') == ''))
- $error['drupal_directory'] = theme('error', t("You must set your site's name on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
+ form_set_error('drupal_directory', t("You must set your site's name on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
else if (variable_get('site_mail', ini_get('sendmail_from')) == '')
- $error['drupal_directory'] = theme('error', t("You must set your site's e-mail address on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
+ form_set_error('drupal_directory', t("You must set your site's e-mail address on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
else if (variable_get('site_slogan', '') == '')
- $error['drupal_directory'] = theme('error', t("You must set your site's slogan on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
+ form_set_error('drupal_directory', t("You must set your site's slogan on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
else if (variable_get('site_mission', '') == '')
- $error['drupal_directory'] = theme('error', t("You must set your site's mission on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
+ form_set_error('drupal_directory', t("You must set your site's mission on the <a href=\"%url\">administer &raquo; settings</a> page.", array('%url' => url('admin/settings'))));
$output = form_textfield(t('Drupal XML-RPC server'), 'drupal_server', variable_get('drupal_server', 'http://www.drupal.org/xmlrpc.php'), 55, 128, t('The URL of your root Drupal XML-RPC server.'));
- $output .= form_radios(t('Drupal directory'), 'drupal_directory', variable_get('drupal_directory', 0), array(t('Disabled'), t('Enabled')), t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php", "%drupal-sites" => "http://www.drupal.org/sites/")) . $error['drupal_directory']);
+ $output .= form_radios(t('Drupal directory'), 'drupal_directory', variable_get('drupal_directory', 0), array(t('Disabled'), t('Enabled')), t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php", "%drupal-sites" => "http://www.drupal.org/sites/")));
return $output;
}