arteleku_drupal_module/plugins/styles/slide.inc
2017-12-15 01:09:28 +01:00

89 lines
1.9 KiB
PHP

<?php
/**
* @file
* Definition of the 'slide' panel style.
*/
// Plugin definition
$plugin = array(
'title' => t('Slider'),
'description' => t('Presents the panes in the form of slider.'),
'render region' => 'panels_slide_style_render_region',
);
function theme_panels_slide_style_render_region($vars) {
$display = $vars['display'];
$region_id = $vars['region_id'];
$panes = $vars['panes'];
$settings = $vars['settings'];
$items = array();
if (module_exists('libraries')) {
// Load jQuery Cycle
if ($cycle_path = _slide_cycle_library_path()) {
drupal_add_js($cycle_path);
drupal_add_js(drupal_get_path('module', 'arteleku') . '/plugins/styles/slide.js');
}
}
$output = '';
$output = '<div id="slider-panel">';
foreach ($panes as $pane_id => $pane) {
$output .= $pane;//theme('panels_slide_style_render_pane');
}
$output .= '</div><div class=clearfix"></div>';
return $output;
}
function _slide_cycle_library_path() {
$cycle_path = libraries_get_path('jquery.cycle');
if (!empty($cycle_path)) {
// Attempt to use minified version of jQuery cycle plugin.
if (file_exists($cycle_path . '/jquery.cycle.all.min.js')) {
$cycle_path .= '/jquery.cycle.all.min.js';
}
// Otherwise use non-minified version if available.
elseif (file_exists($cycle_path . '/jquery.cycle.all.js')) {
$cycle_path .= '/jquery.cycle.all.js';
}
else {
$cycle_path = FALSE;
}
}
else {
$cycle_path = FALSE;
}
return $cycle_path;
}
/**
* Settings form callback.
*/
/*function panels_list_style_settings_form($style_settings) {
$form['list_type'] = array(
'#type' => 'select',
'#title' => t('List type'),
'#options' => array(
'ul' => t('Unordered'),
'ol' => t('Ordered'),
),
'#default_value' => (isset($style_settings['list_type'])) ? $style_settings['list_type'] : 'ul',
);
return $form;
}*/