function theme_signup_custom_data in Signup 6.2
Same name and namespace in other branches
- 5.2 signup.module \theme_signup_custom_data()
- 5 signup.module \theme_signup_custom_data()
- 6 theme/node.admin.inc \theme_signup_custom_data()
- 7 theme/node.admin.inc \theme_signup_custom_data()
Renders custom signup user data into a human-readable format.
WARNING: This theme function is recursive (it calls itself for nested data), so if you override it, be sure not to change the part where it does "call_user_func(__FUNCTION__)".
Parameters
$data: Array of custom user signup data.
Return value
User data directly formatted in divs.
See also
2 theme calls to theme_signup_custom_data()
- signup_node_admin_details_form in includes/
node_admin.inc - signup_token_values in ./
signup.module - Implement hook_token_values() (from token.module)
File
- theme/
node.admin.inc, line 123 - Theme functions for the signup node administration page (node/N/signups).
Code
function theme_signup_custom_data($data) {
$output = '';
// All of the possible array key values should already be translated as
// string literals in theme_signup_user_form() via the #title attributes, so
// passing a variable to t() is actually safe here. However, to avoid
// warnings when extracting strings, "hide" the call to t() by using a
// variable to hold the function name.
$tr = 't';
// Loop through each first level element.
foreach ($data as $key => $value) {
$output .= '<div id="' . signup_id_safe($key) . '">';
if (is_array($value)) {
// Element is nested, render it recursively.
// Instead of the overhead of theme(), just call ourself directly.
$output .= call_user_func(__FUNCTION__, $value);
}
else {
// If a key is numeric, we assume the module that set it knows what it is
// doing and provides its own label.
if (is_numeric($key)) {
$output .= check_plain($value);
}
else {
$output .= $tr($key) . ': ' . check_plain($value);
}
}
$output .= "</div>\n";
}
return $output;
}