You are here

slick_example.module in Slick extras 7.2

Provides Slick carousel examples.

Provides samples for Optionsets, Image styles, Views blocks and a few supported alters. Please do not use this module for your works, instead clone it to learn how to make the most out of Slick module. This module will be updated at times to reflect the best shot Slick can give, so it may not keep your particular use.

File

slick_example/slick_example.module
View source
<?php

/**
 * @file
 * Provides Slick carousel examples.
 *
 * Provides samples for Optionsets, Image styles, Views blocks and a few
 * supported alters.
 * Please do not use this module for your works, instead clone it to learn how
 * to make the most out of Slick module. This module will be updated at times to
 * reflect the best shot Slick can give, so it may not keep your particular use.
 */

/**
 * Implements hook_ctools_plugin_api().
 */
function slick_example_ctools_plugin_api($module, $api) {
  if ($module == 'slick' && $api == 'slick_default_preset') {
    return array(
      'version' => 1,
    );
  }
}

/**
 * Implements hook_views_api().
 */
function slick_example_views_api($module, $api) {
  if ($module == 'views' && $api == 'views_default') {
    return array(
      'api' => 3,
    );
  }
}

/**
 * Implements hook_slick_skins_info().
 *
 * This function may live in module file, or my_module.slick.inc if you have
 * many skins.
 */

/* -- Delete this line if you want to use this function.
function slick_example_slick_skins_info() {
// $module_path = drupal_get_path('module', 'slick_example');
// return array(
// 'x_testimonial' => array(
// 'name' => t('X: Testimonial'),
// 'description' => t('Testimonial with thumbnail and slidesToShow 2.'),
// 'css' => array(
// $module_path . '/css/slick.theme--x-testimonial.css' => array(),
// ),
// )
// );
}
// */

/**
 * Implements hook_slick_skins_info_alter().
 *
 * Overriding skin CSS and JS can be done using relevant hooks: hook_css_alter,
 * or hook_js_later, or regular stylesheets[] array overrides via my_theme.info,
 * or using this function to execute earlier before being passed to
 * drupal_process_attached().
 *
 * @param array $skins
 *   The associative array of skin information from hook_slick_skins_info().
 *
 * @see hook_slick_skins_info()
 */

/* -- Delete this line if you want to use this function.
function slick_example_slick_skins_info_alter(array &$skins) {
// The samples are adjusted to not exceed 80 characters.
// $module_path = drupal_get_path('module', 'slick_example');
// $path = drupal_get_path('theme', 'my_theme');

// Adds slick_example.asnavfor.js to skin asNavFor thumbnail.
// Add the weight < 0 to act on slick events.
// $js = array($module_path . '/js/slick_example.asnavfor.js' => array());
// $skins['asnavfor']['js'] = $js;

// Modify the default skin's name and description.
// $skins['default']['name'] = t('My Theme: Default');
// $skins['default']['description'] = t('My Theme default skin.');

// This one won't work.
// $skins['default']['css'][$path . '/css/slick.theme--base.css'] = array();

// This one overrides slick.theme--default.css with slick.theme--base.css
// The CSS is provided by my_theme.
// $css = array($path . '/css/slick.theme--base.css' => array());
// $skins['default']['css'] = $css;

// Overrides skin asNavFor with theme CSS.
// The CSS is provided by my_theme.
// $skins['asnavfor']['name'] = t('My Theme: asnavfor');
// $css = array($path . '/css/slick.theme--asnavfor.css' => array());
// $skins['asnavfor']['css'] = $css;

// Or with the new name.
// $css = array($path . '/css/slick.theme--asnavfor-new.css' => array());
// $skins['asnavfor']['css'] = $css;

// Overrides skin Fullwidth with theme CSS.
// The CSS is provided by my_theme.
// $skins['fullwidth']['name'] = t('My Theme: fullwidth');
// $css = array($path . '/css/slick.theme--fullwidth.css' => array());
// $skins['fullwidth']['css'] = $css;
}
// */

/**
 * Implements hook_image_default_styles().
 */
function slick_example_image_default_styles() {
  $styles = array();
  $styles['slick'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 1380,
          'height' => 420,
        ),
        'weight' => 0,
      ),
    ),
  );
  $styles['slick_140x80'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 140,
          'height' => 80,
        ),
        'weight' => 0,
      ),
    ),
  );
  $styles['slick_300'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 300,
          'height' => 300,
        ),
        'weight' => 0,
      ),
    ),
  );
  $styles['slick_600'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 600,
          'height' => 600,
        ),
        'weight' => 0,
      ),
    ),
  );
  $styles['slick_600x460'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 600,
          'height' => 460,
        ),
        'weight' => 0,
      ),
    ),
  );
  $styles['slick_600x320'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 600,
          'height' => 320,
        ),
        'weight' => 0,
      ),
    ),
  );
  $styles['slick_640x360'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 640,
          'height' => 360,
        ),
        'weight' => 0,
      ),
    ),
  );
  $styles['slick_1280'] = array(
    'effects' => array(
      array(
        'name' => 'image_scale_and_crop',
        'data' => array(
          'width' => 1280,
          'height' => 520,
        ),
        'weight' => 0,
      ),
    ),
  );
  return $styles;
}