summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJennifer Hodgdon <yahgrp@poplarware.com>2012-07-26 11:44:26 -0700
committerJennifer Hodgdon <yahgrp@poplarware.com>2012-07-26 11:44:26 -0700
commit88403dd0251169f00c16cb58dcd9676be2115618 (patch)
tree390f56be28ae96f91d63a0edeac4d3df9040ece0
parent72177b018911523f825faf6e889cc2b0ddfff969 (diff)
downloadbrdo-88403dd0251169f00c16cb58dcd9676be2115618.tar.gz
brdo-88403dd0251169f00c16cb58dcd9676be2115618.tar.bz2
Issue #1697750 by TravisCarden: Improve documentation of drupal_set_message function
-rw-r--r--includes/bootstrap.inc37
1 files changed, 26 insertions, 11 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index d9f5aa1d8..30ab874d7 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -1747,22 +1747,37 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
}
/**
- * Sets a message which reflects the status of the performed operation.
+ * Sets a message to display to the user.
*
- * If the function is called with no arguments, this function returns all set
- * messages without clearing them.
+ * Messages are stored in a session variable and displayed in page.tpl.php via
+ * the $messages theme variable.
*
- * @param $message
- * The message to be displayed to the user. For consistency with other
- * messages, it should begin with a capital letter and end with a period.
- * @param $type
- * The type of the message. One of the following values are possible:
+ * Example usage:
+ * @code
+ * drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
+ * @endcode
+ *
+ * @param string $message
+ * (optional) The translated message to be displayed to the user. For
+ * consistency with other messages, it should begin with a capital letter and
+ * end with a period.
+ * @param string $type
+ * (optional) The message's type. Defaults to 'status'. These values are
+ * supported:
* - 'status'
* - 'warning'
* - 'error'
- * @param $repeat
- * If this is FALSE and the message is already set, then the message won't
- * be repeated.
+ * @param bool $repeat
+ * (optional) If this is FALSE and the message is already set, then the
+ * message won't be repeated. Defaults to TRUE.
+ *
+ * @return array|null
+ * A multidimensional array with keys corresponding to the set message types.
+ * The indexed array values of each contain the set messages for that type.
+ * Or, if there are no messages set, the function returns NULL.
+ *
+ * @see drupal_get_messages()
+ * @see theme_status_messages()
*/
function drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE) {
if ($message) {