I used my code so display only single images in search result for Display suite module. It was working fine before I upgraded but now the images don't show. I ran update.php so I don't know what the problem is.

Here is my code

<?php
$i = 0;
$output = '';
foreach (element_children($element) as $key) {
  if ($i < 1) {
    $item = $element[$key]['#item'];
    if (empty($item['filepath'])) {
      continue;
    }
    $i++;
    $alt = isset($item['data']['alt']) ? $item['data']['alt'] : '';
    $title = isset($item['data']['title']) ? $item['data']['title'] : NULL;
    $output .= theme('imagecache', 'product_list', $item['filepath'], $alt, $title);
  }
}
return $output;
?>

Comments

clintthayer’s picture

Hey Fehin... any resolution on your end?

fehin’s picture

Nope, I can't find what is wrong.

Korinvall’s picture

Subscribing

taits’s picture

Subscribed...

WesleyTx’s picture

Issue stopped for me after updating to the latest dev.

Deciphered’s picture

Status: Active » Fixed

Marking as fixed, please re-open if otherwise.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

fehin’s picture

Status: Closed (fixed) » Active

Still having this problem.

Deciphered’s picture

Status: Active » Postponed (maintainer needs more info)

Hi fehin,

Apologies for the confusion, I can't see any reason why I marked this as fixed... who knows what I was thinking at the time.

Can you confirm if this formatter is supposed to handle multiple values? If so, it seems to work perfectly for me.

If not, then there is either an issue in the code or a regression error on my behalf (which I'm in the process of trying to confirm). Currently if it's not a multiple values formatter there will be no element children to loop through, the single item will be in #item.

Hope we can get this one sorted.

Cheers,
Deciphered.

tinker’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active

I upgraded to 1.6 and all my customer formatters stopped working. I tracked down two problems:

Theme formatter function names seems to have changed.
I noticed this using devel render and it was under: $node['content'][(fieldname)]['field']['items']['theme'].

The stored value, I'm guessing from pre upgrade was (customer formatter is called 'decimal_measurement'):
number_formatter_custom_formatters_decimal_measurement

This did not work and I finally edited the content type setting the 'display fields' values again. Without changing the custom formatter the new theme function stored became:
custom_formatters_formatter_custom_formatters_decimal_measurement
This correctly triggers the formatter.

The custom formatter is no longer chained with the default formatter.
I was comparing $element['#item']['value'] with $element['#item']['view'] to quickly get field suffixes. Now $element['#item']['view'] is no longer there. I have created probably better code that looks up the content field suffix.

Deciphered’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

I am no longer supporting any Drupal 6 modules, as such I am marking this as closed.

However, I am open to taking on co-maintainers, if you wish to do so contact me via me D.o contact form.