Posted by inolen on June 5, 2011 at 5:21pm
5 followers
| Project: | Views Slideshow |
| Version: | 7.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
You currently can't override views-slideshow-pager-field.tpl.php due to the fact that the key provided in hook_theme() doesn't match the name of the template file (see http://drupal.org/node/342350).
I've attached a patch which resolves this.
| Attachment | Size |
|---|---|
| pager_fields_template.patch | 2.66 KB |
Comments
#1
Also, to add to this, I was over-riding this template to add some jCarousel wrapper elements but that then broke functionality in Drupal.behaviors.viewsSlideshowPagerFields.
When it adds handlers on the pager items in the Drupal.behaviors.viewsSlideshowPagerFields.attach function, it calls:
$(this).children().each(function (index, pagerItem) {This breaks when the immediate children aren't the pager items, so to fix it I did:
$(this).find('.views_slideshow_pager_field_item').each(function (index, pagerItem) {I'm not sure if this is the best fix, but it got me up and running.
#2
Final note is that after making the template overrideable, I then only wanted to override it for specific views, so I added:
$vars['theme_hook_suggestions'][] = 'views_slideshow_pager_fields__' . $vars['view']->name;inside of template_preprocess_views_slideshow_pager_fields(). I also added the same for the field item templates. If anyone would like I could re-roll the original patch, js changes and these hook suggestions into one patch.
#3
Just encountered this and the posted patch worked...after I noticed that the name of the template file changed too. There seems to be remaining issues with other templates though.
#4
There are definitely other things that don't theme properly, and yes, the template name changed a bit.
I'll re-roll my patch with everything I ended up doing later tonight.
#5
Re-rolled the patch, what it fixes:
- Makes it possible to override what is now views-slideshow-pager-fields.tpl.php (was views-slideshow-pager-field.tpl.php) and views-slideshow-pager-field-item.tpl.php
- Adds suggestions for each of the above .tpl.php based on your view name
- Fixes JS error when the field items aren't the direct children of the main element in views-slideshow-pager-fields.tpl.php. For example, my custom views-slideshow-pager-field.tpl.php looks like so:
<div id="<?php print $widget_id; ?>" class="<?php print $classes; ?>"><div class="jcarousel-wrapper jcarousel-skin-default">
<div class="jcarousel article-image-gallery-carousel">
<ul class="clearfix">
<?php print $rendered_field_items; ?>
</ul>
</div>
<div class="jcarousel-prev"></div>
<div class="jcarousel-next"></div>
</div>
</div>
Patched against the latest on 7.x-3.x-dev.
#6
Thanks, the patch from #5 solves the original issue for me. Hopefully this gets committed soon because this issue makes theming quite difficult. I created a separate issue for the other (less significant) template that's been broken for me: #1191586: Cannot override views-slideshow-controls-text.tpl.php.
#7
A patch similar to this was committed. None of the javascript was committed and should be added to a new issue with a thorough description of the problem.
#8
Automatically closed -- issue fixed for 2 weeks with no activity.