Go to the source code of this file.
Functions | |
| _panels_profile_fields_options () | |
| panels_profile_fields_configure ($id, $parents, $conf=array()) | |
| panels_profile_fields_configure_title ($conf, $context) | |
| panels_profile_fields_content ($conf, $panel_args, $context) | |
| panels_profile_fields_content_type () | |
| panels_profile_fields_panels_content_types () | |
| theme_profile_fields_pane ($category, $vars) | |
| _panels_profile_fields_options | ( | ) |
Helper function : build the list of categories for the 'edit' form.
Definition at line 105 of file profile_fields.inc.
Referenced by panels_profile_fields_configure().
00105 { 00106 $cat_list = array(); 00107 00108 $categories = profile_categories(); 00109 foreach ($categories as $key => $value) { 00110 $cat_list[str_replace(" ", "_", $value['name'])] = $value['title']; 00111 } 00112 00113 return $cat_list; 00114 }
| panels_profile_fields_configure | ( | $ | id, | |
| $ | parents, | |||
| $ | conf = array() | |||
| ) |
'Edit' callback for the 'profile fields' content type.
Definition at line 119 of file profile_fields.inc.
References _panels_profile_fields_options().
00119 { 00120 // Apply defaults 00121 if (empty($conf)) { 00122 $conf = array('title' => '', 'category' => '', 'empty' => ''); 00123 } 00124 00125 $form['category'] = array( 00126 '#type' => 'radios', 00127 '#title' => t('Which category'), 00128 '#options' => _panels_profile_fields_options(), 00129 '#default_value' => $conf['category'], 00130 '#prefix' => '<div class="clear-block no-float">', 00131 '#suffix' => '</div>', 00132 ); 00133 00134 $form['empty'] = array( 00135 '#type' => 'textarea', 00136 '#title' => 'Empty text', 00137 '#description' => t('Text to display if category has no data. Note that title will not display unless overridden.'), 00138 '#rows' => 5, 00139 '#default_value' => $conf['empty'], 00140 '#prefix' => '<div class="clear-block no-float">', 00141 '#suffix' => '</div>', 00142 ); 00143 00144 return $form; 00145 }
| panels_profile_fields_configure_title | ( | $ | conf, | |
| $ | context | |||
| ) |
'Title' callback for the 'profile fields' content type.
Definition at line 150 of file profile_fields.inc.
| panels_profile_fields_content | ( | $ | conf, | |
| $ | panel_args, | |||
| $ | context | |||
| ) |
'Render' callback for the 'profile fields' content type.
Definition at line 28 of file profile_fields.inc.
00028 { 00029 $account = isset($context->data) ? drupal_clone($context->data) : NULL; 00030 $block = new stdClass(); 00031 $block->module = 'profile fields'; 00032 00033 if ($account) { 00034 // Get the category from the options 00035 $category = str_replace("_", " ", $conf['category']); 00036 00037 // Set the subject to the name of the category 00038 $block->subject = $category; 00039 00040 // Put all the fields in the category into an array 00041 $profile = profile_view_profile($account); 00042 if (is_array($profile[$category])) { 00043 foreach ($profile[$category] as $field) { 00044 $vars[$field['class']]['title'] = $field['title']; 00045 $vars[$field['class']]['value'] = $field['value']; 00046 } 00047 } 00048 00049 if (sizeof($vars) == 0) { 00050 // Output the given empty text 00051 $output = $conf['empty']; 00052 } 00053 else { 00054 // Call the theme function with the field vars 00055 $output = theme('profile_fields_pane', $category, $vars); 00056 } 00057 00058 $block->content = $output; 00059 $block->delta = $account->uid; 00060 } 00061 else { 00062 $block->subject = $conf['category']; 00063 $block->content = t('Profile content goes here.'); 00064 $block->delta = 'unknown'; 00065 } 00066 00067 return $block; 00068 }
| panels_profile_fields_content_type | ( | ) |
Return all content types available.
Definition at line 89 of file profile_fields.inc.
References panels_get_path().
00089 { 00090 return array( 00091 'description' => array( 00092 'title' => t('Profile Category'), 00093 'icon' => 'icon_user.png', 00094 'path' => panels_get_path('content_types/user'), 00095 'description' => t('Profile category contents.'), 00096 'required context' => new panels_required_context(t('User'), 'user'), 00097 'category' => array(t('User context'), -9), 00098 ), 00099 ); 00100 }
| panels_profile_fields_panels_content_types | ( | ) |
Callback function to supply a list of content types.
Definition at line 8 of file profile_fields.inc.
00008 { 00009 $items = array(); 00010 if (module_exists('profile') && !is_null(profile_categories())) { 00011 $items['profile_fields'] = array( 00012 'title' => t('Profile Fields'), 00013 'content_types' => 'panels_profile_fields_content_type', 00014 // only provides a single content type 00015 'single' => TRUE, 00016 'render callback' => 'panels_profile_fields_content', 00017 'add callback' => 'panels_profile_fields_configure', 00018 'edit callback' => 'panels_profile_fields_configure', 00019 'title callback' => 'panels_profile_fields_configure_title', 00020 ); 00021 } 00022 return $items; 00023 }
| theme_profile_fields_pane | ( | $ | category, | |
| $ | vars | |||
| ) |
Theme the profile fields retrieved in panels_profile_fields_content
Definition at line 73 of file profile_fields.inc.
00073 { 00074 if (is_array($vars)) { 00075 foreach ($vars as $class => $field) { 00076 $output .= '<dl class="profile-category">'; 00077 $output .= '<dt class="profile-' . $class . '">' . $field['title'] . '</dt>'; 00078 $output .= '<dd class="profile-' . $class . '">' . $field['value'] . '</dd>'; 00079 $output .= '</dl>'; 00080 } 00081 } 00082 00083 return $output; 00084 }
1.5.6