12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * Field handler to provide simple renderer that allows using a themed user link
- */
- class tweak_handler_field_user_picture_preset extends views_handler_field_user_picture {
- function option_definition() {
- $options = parent::option_definition();
- $options['preset'] = array(
- 'default' => $this->definition['preset'],
- 'translatable' => FALSE,
- );
- return $options;
- }
- /**
- * Choose a preset
- */
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
- $options = array('0' => t('None'));
- foreach (imagecache_presets() as $pid => $preset) {
- $options[$pid] = $preset['presetname'];
- }
- $form['preset'] = array(
- '#type' => 'select',
- '#title' => t('Imagecache preset'),
- '#options' => $options,
- '#default_value' => isset($this->options['preset']) ? $this->options['preset'] : '0',
- );
- }
- function admin_summary() {
- $pid = $this->options['preset'];
- if ($pid) {
- $preset = imagecache_preset($pid);
- $ret = $preset['presetname'];
- }
- else {
- $ret = t('Raw');
- }
- return $ret;
- }
- function render($values) {
- $pid = $this->options['preset'];
- if ($pid) {
- $preset = imagecache_preset($pid);
- return theme_imagecache($preset['presetname'], $this->get_value($values));
- }
- else {
- return parent::render($values);
- }
- }
- }
|