You are here

function panels_profile_fields_content in Panels 5.2

Same name and namespace in other branches
  1. 6.2 content_types/profile_fields.inc \panels_profile_fields_content()

'Render' callback for the 'profile fields' content type.

1 string reference to 'panels_profile_fields_content'
panels_profile_fields_panels_content_types in content_types/profile_fields.inc
Callback function to supply a list of content types.

File

content_types/profile_fields.inc, line 27

Code

function panels_profile_fields_content($conf, $panel_args, $context) {
  $account = isset($context->data) ? drupal_clone($context->data) : NULL;
  $block = new stdClass();
  $block->module = 'profile fields';
  if ($account) {

    // Get the category from the options
    $category = str_replace("_", " ", $conf['category']);

    // Set the subject to the name of the category
    $block->subject = $category;

    // Put all the fields in the category into an array
    $profile = profile_view_profile($account);
    if (is_array($profile[$category])) {
      foreach ($profile[$category] as $field) {
        $vars[$field['class']]['title'] = $field['title'];
        $vars[$field['class']]['value'] = $field['value'];
      }
    }
    if (sizeof($vars) == 0) {

      // Output the given empty text
      $output = $conf['empty'];
    }
    else {

      // Call the theme function with the field vars
      $output = theme('profile_fields_pane', $category, $vars);
    }
    $block->content = $output;
    $block->delta = $account->uid;
  }
  else {
    $block->subject = $conf['category'];
    $block->content = t('Profile content goes here.');
    $block->delta = 'unknown';
  }
  return $block;
}