Edit view of images

scedwar - April 18, 2008 - 16:23
Project:Editview
Version:6.x-1.0-beta1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm trying to create an edit view that will show a thumbnail of an image with the editable title next to it. I've got a list that works fine in table view, however changing it to an editview I lose the images.

Any ideas?

#1

dman - May 20, 2008 - 08:16

I've replaced
editview_field_form_render() [296]
with:

<?php
/**
* Implementation of hook_field_form_render()
*/
function editview_field_form_render($field, &$form, $view) {
 
$element = array('class' => 'editview-field editview-'. preg_replace('/[^a-z0-9]+/', '-', strtolower($field['fullname'])));
 
$element['valign'] = 'top';

 
$vocab_id = str_replace('term_node_', '', $field['tablename']);
  if (
is_numeric($vocab_id)) {
    if(
$form['taxonomy'][$vocab_id]) {
      unset(
$form['taxonomy'][$vocab_id]['#description']);
     
$element['data'] = drupal_render($form['taxonomy'][$vocab_id]);
    }
    else {
      unset(
$form['taxonomy']['tags'][$vocab_id]['#description']);
     
$element['data'] = drupal_render($form['taxonomy']['tags'][$vocab_id]);
    }
  }
  else {
    if(
$field['handler'] == 'image_views_handler_image_img') {
     
$element['data'] .= l($form['thumbnail']['#value'], 'node/'.$form['#node']->nid, array(), NULL, NULL, NULL, TRUE);
      return
$element;
    }

    switch (
$field['field']) {
      case
'iid':
        unset(
$form['image_attach']['iid']['#description']);
       
$element['data'] = drupal_render($form['image_attach']['iid']);
       
$form['image_attach']['image']['#size'] = 20;
       
$element['data'] .= drupal_render($form['image_attach']['image']);
        break;
      case
'field_product_links_url':
        unset(
$form['field_product_links']['more']);
        unset(
$form['field_product_links']['tokens']);
       
$element['data'] = drupal_render($form['field_product_links']);
        break;
      default:
       
$element['data'] = editview_search_for_field($field, $form, $view);
        break;
    }
  }
  return empty(
$element['data']) ? null : $element;
}
?>

... this supports images, and also has a patch for taxonomies. Only freetagging was showing up before IIRC - this now allows both.
Compare with yours and merge carefully.
It's the
    if($field['handler'] == 'image_views_handler_image_img') {
      $element['data'] .= l($form['thumbnail']['#value'], 'node/'.$form['#node']->nid, array(), NULL, NULL, NULL, TRUE);
      return $element;
    }

you need

#2

Jorge - June 11, 2009 - 13:42
Version:5.x-0.3» 6.x-1.0-beta1

Hello dman,
I'm wondering if you have changed editview module (or have any idea about how to do) with the same characteristic to the new version of Drupal (6), Editview (6.x-1.0-beta1) and Taxonomy images. I was looking in the files, but the code has changed and my php skills are very poor.

I'm looking for change Taxonomy terms and show Images, Taxonomy terms and images and, if posible, Labels (Nid for example) and Links with Editview.

Many thansks in advance for any help.

Jorge

 
 

Drupal is a registered trademark of Dries Buytaert.