|
@@ -0,0 +1,62 @@
|
|
|
|
+<?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['title'],
|
|
|
|
+ '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' => $this->options['preset'],
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ if (!empty($form_state['exposed'])) {
|
|
|
|
+ $identifier = $this->options['expose']['identifier'];
|
|
|
|
+ if (!isset($form_state['input'][$identifier])) {
|
|
|
|
+ $form_state['input'][$identifier] = $this->value;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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'], $values->{$this->field_alias});
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return parent::render($values);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|