You are here

class imagecache_profiles_handler_field_user_picture in ImageCache Profiles 6

Same name and namespace in other branches
  1. 7 views/imagecache_profiles_handler_field_user_picture.inc \imagecache_profiles_handler_field_user_picture

Hierarchy

Expanded class hierarchy of imagecache_profiles_handler_field_user_picture

1 string reference to 'imagecache_profiles_handler_field_user_picture'
imagecache_profiles_views_data_alter in views/imagecache_profiles.views.inc

File

views/imagecache_profiles_handler_field_user_picture.inc, line 3

View source
class imagecache_profiles_handler_field_user_picture extends views_handler_field_user_picture {
  function option_definition() {
    $options = parent::option_definition();
    $options['imagecache_preset'] = array(
      'default' => variable_get('user_picture_imagecache_profiles_default', ''),
      'translatable' => FALSE,
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $presets = imagecache_presets();
    $opt = array(
      '' => '',
    );
    foreach ($presets as $preset) {
      $opt[$preset['presetname']] = check_plain($preset['presetname']);
    }
    $options = $this->options;
    $form['imagecache_preset'] = array(
      '#title' => t('Imagecache preset'),
      '#type' => 'select',
      '#options' => $opt,
      '#default_value' => $options['imagecache_preset'],
    );
  }
  function render($values) {

    // Fake an account object.
    $options = $this->options;
    $account = new stdClass();
    $account->uid = $values->{$this->aliases['uid']};
    $account->name = $values->{$this->aliases['name']};
    $account->mail = isset($values->{$this->aliases['mail']}) ? $values->{$this->aliases['mail']} : '';
    $account->picture = $values->{$this->field_alias};
    if ($options['imagecache_preset']) {
      $account->imagecache_preset = $options['imagecache_preset'];
    }
    return theme('user_picture', $account);
  }

}

Members