Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
clintthayer CreditAttribution: clintthayer commentedHey Fehin... any resolution on your end?
Comment #2
fehin CreditAttribution: fehin commentedNope, I can't find what is wrong.
Comment #3
Korinvall CreditAttribution: Korinvall commentedSubscribing
Comment #4
taits CreditAttribution: taits commentedSubscribed...
Comment #5
WesleyTx CreditAttribution: WesleyTx commentedIssue stopped for me after updating to the latest dev.
Comment #6
Deciphered CreditAttribution: Deciphered commentedMarking as fixed, please re-open if otherwise.
Comment #8
fehin CreditAttribution: fehin commentedStill having this problem.
Comment #9
Deciphered CreditAttribution: Deciphered commentedHi 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.
Comment #10
tinker CreditAttribution: tinker commentedI 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.
Comment #11
Deciphered CreditAttribution: Deciphered commentedI 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.