summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/blog.module8
-rw-r--r--modules/blog/blog.module8
-rw-r--r--modules/profile.module8
-rw-r--r--modules/profile/profile.module8
-rw-r--r--modules/user.module36
-rw-r--r--modules/user/user.module36
6 files changed, 64 insertions, 40 deletions
diff --git a/modules/blog.module b/modules/blog.module
index b8a2c9204..d561c6a9a 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -42,11 +42,11 @@ function blog_access($op, $node) {
*/
function blog_user($type, &$edit, &$user) {
if ($type == 'view' && user_access('edit own blog', $user)) {
- $form['blog'] = array(
- '#type' => 'item', '#title' => t('Blog'),
- '#value' => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name))))
+ $items[] = array('title' => t('Blog'),
+ 'value' => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name)))),
+ 'class' => 'blog',
);
- return array(t('History') => $form);
+ return array(t('History') => $items);
}
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index b8a2c9204..d561c6a9a 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -42,11 +42,11 @@ function blog_access($op, $node) {
*/
function blog_user($type, &$edit, &$user) {
if ($type == 'view' && user_access('edit own blog', $user)) {
- $form['blog'] = array(
- '#type' => 'item', '#title' => t('Blog'),
- '#value' => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name))))
+ $items[] = array('title' => t('Blog'),
+ 'value' => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name)))),
+ 'class' => 'blog',
);
- return array(t('History') => $form);
+ return array(t('History') => $items);
}
}
diff --git a/modules/profile.module b/modules/profile.module
index 5560bba6e..c9cdfaa60 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -315,11 +315,13 @@ function profile_view_profile($user) {
if ($value = profile_view_field($user, $field)) {
$description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
$title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
- $form = array('#title' => $title, '#value' => $value, '#description' => $description);
- $fields[$field->category][$field->name] = theme('item', $form);
+ $item = array('title' => $title,
+ 'value' => $value,
+ 'class' => $field->name,
+ );
+ $fields[$field->category][] = $item;
}
}
-
return $fields;
}
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 5560bba6e..c9cdfaa60 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -315,11 +315,13 @@ function profile_view_profile($user) {
if ($value = profile_view_field($user, $field)) {
$description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
$title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
- $form = array('#title' => $title, '#value' => $value, '#description' => $description);
- $fields[$field->category][$field->name] = theme('item', $form);
+ $item = array('title' => $title,
+ 'value' => $value,
+ 'class' => $field->name,
+ );
+ $fields[$field->category][] = $item;
}
}
-
return $fields;
}
diff --git a/modules/user.module b/modules/user.module
index 4ac21d46e..333d10d49 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -459,8 +459,12 @@ function user_search($op = 'search', $keys = null) {
*/
function user_user($type, &$edit, &$user, $category = NULL) {
if ($type == 'view') {
- $form['member'] = array('#type' => 'item', '#title' => t('Member for'), '#value' => format_interval(time() - $user->created));
- return array(t('History') => array('history'=> drupal_get_form('member', $form)));
+ $items[] = array('title' => t('Member for'),
+ 'value' => format_interval(time() - $user->created),
+ 'class' => 'member',
+ );
+
+ return array(t('History') => $items);
}
if ($type == 'form' && $category == 'account') {
@@ -612,19 +616,24 @@ function theme_user_picture($account) {
/**
* Theme a user page
* @param $account the user object
- * @param $fields an mulidimensional array for the fields, in the form of
- * array('category1'=> array('name1' => field1, 'name2' => field2),
- * 'category2'=> array('name3' => field3, 'name4' => field4, 'name5' => field5),
- * .. etc);
+ * @param $fields a multidimensional array for the fields, in the form of array (
+ * 'category1' => array(item_array1, item_array2), 'category2' => array(item_array3,
+ * .. etc.). Item arrays are formatted as array(array('title' => 'item title',
+ * 'value' => 'item value', 'class' => 'class-name'), ... etc.). Module names are incorporated
+ * into the CSS class.
*
* @ingroup themeable
*/
function theme_user_profile($account, $fields) {
$output = "<div class=\"profile\">\n";
$output .= theme('user_picture', $account);
- foreach ($fields as $category => $value) {
- $value = implode('', $value);
- $output .= theme('box', $category, $value);
+ foreach ($fields as $category => $items) {
+ $output .= "<h2 class=\"title\">$category</h2>\n";
+ $output .= '<dl>';
+ foreach ($items as $item) {
+ $output .= sprintf('<dt class="%s">%s:</dt><dd class="%s">%s</dd>', $item['class'], $item['title'], $item['class'], $item['value']);
+ }
+ $output .= '</dl>';
}
$output .= "</div>\n";
@@ -1304,8 +1313,11 @@ function user_view($uid = 0) {
$fields = array();
foreach (module_list() as $module) {
if ($data = module_invoke($module, 'user', 'view', '', $account)) {
- foreach ($data as $category => $content) {
- $fields[$category] = $content;
+ foreach ($data as $category => $items) {
+ foreach ($items as $item) {
+ $item['class'] = "$module-". $item['class'];
+ $fields[$category][] = $item;
+ }
}
}
}
@@ -1942,5 +1954,3 @@ function user_autocomplete($string) {
print drupal_implode_autocomplete($matches);
exit();
}
-
-
diff --git a/modules/user/user.module b/modules/user/user.module
index 4ac21d46e..333d10d49 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -459,8 +459,12 @@ function user_search($op = 'search', $keys = null) {
*/
function user_user($type, &$edit, &$user, $category = NULL) {
if ($type == 'view') {
- $form['member'] = array('#type' => 'item', '#title' => t('Member for'), '#value' => format_interval(time() - $user->created));
- return array(t('History') => array('history'=> drupal_get_form('member', $form)));
+ $items[] = array('title' => t('Member for'),
+ 'value' => format_interval(time() - $user->created),
+ 'class' => 'member',
+ );
+
+ return array(t('History') => $items);
}
if ($type == 'form' && $category == 'account') {
@@ -612,19 +616,24 @@ function theme_user_picture($account) {
/**
* Theme a user page
* @param $account the user object
- * @param $fields an mulidimensional array for the fields, in the form of
- * array('category1'=> array('name1' => field1, 'name2' => field2),
- * 'category2'=> array('name3' => field3, 'name4' => field4, 'name5' => field5),
- * .. etc);
+ * @param $fields a multidimensional array for the fields, in the form of array (
+ * 'category1' => array(item_array1, item_array2), 'category2' => array(item_array3,
+ * .. etc.). Item arrays are formatted as array(array('title' => 'item title',
+ * 'value' => 'item value', 'class' => 'class-name'), ... etc.). Module names are incorporated
+ * into the CSS class.
*
* @ingroup themeable
*/
function theme_user_profile($account, $fields) {
$output = "<div class=\"profile\">\n";
$output .= theme('user_picture', $account);
- foreach ($fields as $category => $value) {
- $value = implode('', $value);
- $output .= theme('box', $category, $value);
+ foreach ($fields as $category => $items) {
+ $output .= "<h2 class=\"title\">$category</h2>\n";
+ $output .= '<dl>';
+ foreach ($items as $item) {
+ $output .= sprintf('<dt class="%s">%s:</dt><dd class="%s">%s</dd>', $item['class'], $item['title'], $item['class'], $item['value']);
+ }
+ $output .= '</dl>';
}
$output .= "</div>\n";
@@ -1304,8 +1313,11 @@ function user_view($uid = 0) {
$fields = array();
foreach (module_list() as $module) {
if ($data = module_invoke($module, 'user', 'view', '', $account)) {
- foreach ($data as $category => $content) {
- $fields[$category] = $content;
+ foreach ($data as $category => $items) {
+ foreach ($items as $item) {
+ $item['class'] = "$module-". $item['class'];
+ $fields[$category][] = $item;
+ }
}
}
}
@@ -1942,5 +1954,3 @@ function user_autocomplete($string) {
print drupal_implode_autocomplete($matches);
exit();
}
-
-