Repeat display settings not honored when field is in a fieldset

fearlsgroove - July 4, 2009 - 05:17
Project:Date
Version:6.x-2.x-dev
Component:Date Repeat API
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

For a date that's contained within a fieldset, when the node is displayed it does not respect date repeat options set in display fields. Instead it always displays all the dates that match the rule.

The problem is in theme_date_display_combination, line 53:

<?php
$context
= !empty($node->content) && !empty($node->content[$field_name]) ? $node->content[$field_name]['#context'] : '';
?>

If the field is within a fieldset, $node->content[$field_name] is not set; instead the value we're looking for is in $node->content[#fieldset_machinename#][$field_name] , or perhaps even deeper if fieldsets are nested.

The only solution i see is to add the location to the variable identifier, parse that and look for a nested value that matches.

#1

fearlsgroove - July 6, 2009 - 02:48

This resolves the issue for me. It might be a bit of a hack? It searches the 'content' variable, looking for the field or anything that has a '#context' value set, whichever it finds first.

I don't see any negative effects of this approach except that the stucture of the CCK arrays could change. Performance impact of transversing such small arrays should be negligable. I was unable to find any more efficient way of determining the context

#2

fearlsgroove - July 6, 2009 - 02:49

Oh yea here's the patch :D

AttachmentSize
date-fieldset-context.patch 1.38 KB

#3

fearlsgroove - July 15, 2009 - 03:39
Status:active» needs review

forgot status ...

#4

fearlsgroove - August 3, 2009 - 15:21

This was partially addressed in a June commit #421258: Date repeat fails to honor formatter settings set in Display Fields - works for full nodes now since there's a default, but it's still broken for teasers. This is rerolled against 2.3/dev

AttachmentSize
date-fieldset-context_2.patch 1.79 KB
 
 

Drupal is a registered trademark of Dries Buytaert.