slick_example.module in Slick extras 7.3
Same filename and directory in other branches
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.moduleView 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_optionset') {
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().
*
* To provide own skins, simply provide the legit class namespace, and the class
* must implement \Drupal\slick\SlickSkinInterface.
*
* @see slick.api.php for mode detailed instruction on this.
* @see \Drupal\slick\SlickSkinInterface
* @see \Drupal\slick_example\SlickExampleSkin
*/
/* -- Delete this line if you want to use this function.
function slick_example_slick_skins_info() {
return '\Drupal\slick_example\SlickExampleSkin';
}
// */
/**
* 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;
}
/**
* Implements hook_help().
*/
function slick_example_help($path, $arg) {
if ($path == 'admin/help#slick_example') {
$output = file_get_contents(dirname(__FILE__) . '/README.md');
return function_exists('_filter_markdown') ? _filter_markdown($output, NULL) : '<pre>' . $output . '</pre>';
}
return '';
}
Functions
Name | Description |
---|---|
slick_example_ctools_plugin_api | Implements hook_ctools_plugin_api(). |
slick_example_help | Implements hook_help(). |
slick_example_image_default_styles | Implements hook_image_default_styles(). |
slick_example_views_api | Implements hook_views_api(). |