jCarousel Skin Registry (hook_jcarousel_skins)

Rob Loach - April 7, 2009 - 20:31
Project:jCarousel
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

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?

#1

Wim Leers - April 7, 2009 - 20:33

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

mfer - November 5, 2009 - 21:43

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

 
 

Drupal is a registered trademark of Dries Buytaert.