Download & Extend

jCarousel Skin Registry (hook_jcarousel_skins)

Project:jCarousel
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Create a hook that registers all available jCarousel skins into a registry so that when adding a jCarousel element to the page with a custom skin, you don't always have to pass the skin path.

<?php
/**
* Implementation of hook_jcarousel_skins().
*/
function jcarousel_jcarousel_skins() {
 
$skins = array();
 
$skins['ie7'] = array(
   
'css' => drupal_get_path('module', 'jcarousel') . '/jcarousel/skins/ie7/ie7.css',
   
'name' => t('IE7'),
  );
 
$skins['tango'] = array(
   
'css' => drupal_get_path('module', 'jcarousel') . '/jcarousel/skins/tango/tango.css',
   
'name' => t('Tango'),
  );
  return
$skins;
}
?>

This should be cached both in static cache and cache_set/get appropriately. The skin registry would be returned by calling jcarousel_skins(). Anyway to implement hook_jcarousel_skins() in a theme?

Comments

#1

Themes can't implement hooks I think? Just write a tiny module for it when you need it.

Thanks for your continued contributions to this module! :)

#2

I would add a custom option that adds no css and a description that this is for themes.

#3

Version:6.x-1.x-dev» 6.x-2.x-dev
Status:active» fixed

This is implemented in the 2.x branch of the module. See the implementation the jcarousel.module includes for itself in jcarousel_jcarousel_skin_info(). The dev release is currently at http://drupal.org/node/982718, I hope to be creating a more official release shortly.

#4

Status:fixed» closed (fixed)

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

#5

how to create a custom skin for jcarousel v 6.x-1.0
great module, thanks

create a small module (in my case as_jcarousel)
create a folder inside (skins in my case)
and point to the css file relative from your module (do not use full paths like in the example above)

<?php
/**
* Implements hook_jcarousel_skin_info().
*/
function as_jcarousel_jcarousel_skin_info() {

 
$skins = array();
 
 
$skins['itunes'] = array(
   
'title' => t('Itunes'),
   
'file' => 'skins/itunes/itunes.css',
  );
 
$skins['dvds'] = array(
   
'title' => t('DVD'),
   
'file' => 'skins/dvds/dvds.css',
  );
  return
$skins;
}

?>
nobody click here