template_preprocess_profile_block

function template_preprocess_profile_block

template_preprocess_profile_block(&$variables)

Process variables for profile-block.tpl.php.

The $variables array contains the following arguments:

  • $account
  • $fields

See also

profile-block.tpl.php

File

modules/profile/profile.module, line 541
Support for configurable user profiles.

Code

function template_preprocess_profile_block(&$variables) {

  $variables['user_picture'] = theme('user_picture', array('account' => $variables['account']));
  $variables['profile'] = array();
  // Supply filtered version of $fields that have values.
  foreach ($variables['fields'] as $field) {
    if ($field->value) {
      $variables['profile'][$field->name] = new stdClass();
      $variables['profile'][$field->name]->title = check_plain($field->title);
      $variables['profile'][$field->name]->value = $field->value;
      $variables['profile'][$field->name]->type = $field->type;
    }
  }

}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!profile!profile.module/function/template_preprocess_profile_block/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部