class jcarousel_style_plugin in jCarousel 7.3
Same name and namespace in other branches
- 8.3 includes/jcarousel_style_plugin.inc \jcarousel_style_plugin
- 6.2 includes/jcarousel_style_plugin.inc \jcarousel_style_plugin
- 7.2 includes/jcarousel_style_plugin.inc \jcarousel_style_plugin
Style plugin to render each item in an ordered or unordered list.
Hierarchy
- class \views_object
- class \views_plugin
- class \views_plugin_style
- class \jcarousel_style_plugin
- class \views_plugin_style
- class \views_plugin
Expanded class hierarchy of jcarousel_style_plugin
1 string reference to 'jcarousel_style_plugin'
- jcarousel_views_plugins in includes/
jcarousel.views.inc - Implements hook_views_plugin().
File
- includes/
jcarousel_style_plugin.inc, line 13 - Contains the jCarousel style plugin.
View source
class jcarousel_style_plugin extends views_plugin_style {
function option_definition() {
$options = parent::option_definition();
$options['wrap'] = array(
'default' => 'circular',
);
$options['skin'] = array(
'default' => 'default',
);
$options['visible'] = array(
'default' => NULL,
);
$options['scroll'] = array(
'default' => '',
);
$options['auto'] = array(
'default' => 0,
);
$options['autoPause'] = array(
'default' => '1',
);
$options['animation'] = array(
'default' => '',
);
$options['start'] = array(
'default' => '1',
);
$options['easing'] = array(
'default' => NULL,
);
$options['vertical'] = array(
'default' => FALSE,
);
$options['center'] = array(
'default' => FALSE,
);
$options['navigation'] = array(
'default' => '',
);
$options['ajax'] = array(
'default' => 0,
);
$options['responsive'] = array(
'default' => 1,
);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// Build the list of skins as options.
$skins = array();
foreach (jcarousel_skins() as $key => $skin) {
$skins[$key] = $skin['title'];
}
$skins[''] = t('None');
// Number of options to provide in count-based options.
$range = drupal_map_assoc(range(1, 10));
$auto_range = array(
'' => t('Auto'),
) + $range;
$form['description'] = array(
'#type' => 'markup',
'#value' => '<div class="messages">' . t('The jCarousel style is affected by several other settings within the display. Enable the "Use AJAX" option on your display to have items loaded dynamically. The "Items to display" option will determine how many items are preloaded into the carousel on each AJAX request. Non-AJAX carousels will contain the total number of items set in the "Items to display" option. Carousels may not be used with the "Use pager" option.') . '</div>',
);
$form['wrap'] = array(
'#type' => 'select',
'#title' => t('Wrap content'),
'#default_value' => $this->options['wrap'],
'#description' => t('Specifies whether to wrap at the first/last item (or both) and jump back to the start/end.'),
'#options' => array(
0 => t('Disabled'),
'circular' => t('Circular'),
'both' => t('Both'),
'last' => t('Last'),
'first' => t('First'),
),
);
$form['skin'] = array(
'#type' => 'select',
'#title' => t('Skin'),
'#default_value' => $this->options['skin'],
'#options' => $skins,
'#description' => t('Skins may be provided by other modules. Set to "None" if your theme includes carousel theming directly in style.css or another stylesheet. "None" does not include any built-in navigation, arrows, or positioning at all.'),
);
$form['responsive'] = array(
'#type' => 'checkbox',
'#title' => t('Responsive'),
'#default_value' => $this->options['responsive'],
'#description' => t('Should the carousel fill the available space and respond to page flow changes? Untick for a fixed-width carousel.'),
);
$form['visible'] = array(
'#type' => 'select',
'#title' => t('Number of visible items'),
'#options' => $auto_range,
'#default_value' => $this->options['visible'],
'#description' => t('Set an exact number of items to show at a time. It is recommended to leave set this to "auto", in which the number of items will be determined automatically by the space available to the carousel.') . ' <strong>' . t('Changing this option will override "width" properties set in your CSS.') . '</strong>',
);
$form['scroll'] = array(
'#type' => 'select',
'#title' => t('Scroll'),
'#description' => t('The number of items to scroll at a time. The "auto" setting scrolls all the visible items.'),
'#options' => $auto_range,
'#default_value' => $this->options['scroll'],
);
$form['auto'] = array(
'#type' => 'textfield',
'#title' => t('Auto-scroll after'),
'#size' => 4,
'#maxlength' => 4,
'#default_value' => $this->options['auto'],
'#field_suffix' => ' ' . t('seconds'),
'#description' => t('Specifies how many seconds to periodically auto-scroll the content. If set to 0 (default) then autoscrolling is turned off.'),
);
$form['navigation'] = array(
'#type' => 'select',
'#title' => t('Enable navigation'),
'#options' => array(
'' => t('None'),
'before' => t('Before'),
'after' => t('After'),
),
'#default_value' => $this->options['navigation'],
'#description' => t('Enable a clickable navigation list to jump straight to a given page.'),
);
$form['ajax'] = array(
'#type' => 'checkbox',
'#title' => t('AJAX load pages'),
'#default_value' => $this->options['ajax'],
'#description' => t('The number of items set in the pager settings will be preloaded. All additional pages will be loaded by AJAX as needed.'),
);
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#parents' => array(
'style_options',
),
);
$form['advanced']['animation'] = array(
'#type' => 'textfield',
'#title' => t('Animation speed'),
'#size' => 10,
'#maxlength' => 10,
'#default_value' => $this->options['animation'],
'#description' => t('The speed of the scroll animation as string in jQuery terms ("slow" or "fast") or milliseconds as integer (See <a href="http://api.jquery.com/animate/">jQuery Documentation</a>).'),
);
$form['advanced']['easing'] = array(
'#type' => 'textfield',
'#title' => t('Easing effect'),
'#size' => 10,
'#maxlength' => 128,
'#default_value' => $this->options['easing'],
'#description' => t('The name of the easing effect that you want to use such as "swing" (the default) or "linear". See list of options in the <a href="http://api.jquery.com/animate/">jQuery Documentation</a>.'),
);
$form['advanced']['start'] = array(
'#type' => 'select',
'#title' => t('Start position'),
'#description' => t('The item that will be shown as the first item in the list upon loading. Useful for starting a list in the middle of a set.'),
'#options' => $range,
'#default_value' => $this->options['start'],
);
$form['advanced']['autoPause'] = array(
'#type' => 'checkbox',
'#title' => t('Pause auto-scroll on hover'),
'#description' => t('If auto-scrolling, pause the carousel when the user hovers the mouse over an item.'),
'#default_value' => $this->options['autoPause'],
);
$form['advanced']['vertical'] = array(
'#type' => 'checkbox',
'#title' => t('Vertical'),
'#description' => t('Specifies whether the carousel appears in horizontal or vertical orientation. Changes the carousel from a left/right style to a up/down style carousel. Defaults to horizontal.'),
'#default_value' => $this->options['vertical'],
);
$form['advanced']['center'] = array(
'#type' => 'checkbox',
'#title' => t('Center'),
'#description' => t('Specifies wether the targeted item should be centered inside the root element. Note: This feature is experimental and may not work with all setups.'),
'#default_value' => $this->options['center'],
);
}
function validate() {
$errors = parent::validate();
if ($this->display->handler
->use_pager()) {
$errors[] = t('The jCarousel style cannot be used with a pager. Disable the "Use pager" option for this display.');
}
return $errors;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
jcarousel_style_plugin:: |
function |
Provide a form to edit options for this plugin. Overrides views_plugin_style:: |
||
jcarousel_style_plugin:: |
function |
Information about options for all kinds of purposes will be held here. Overrides views_plugin_style:: |
||
jcarousel_style_plugin:: |
function |
Validate that the plugin is correct and can be saved. Overrides views_plugin_style:: |
||
views_object:: |
public | property | Handler's definition. | |
views_object:: |
public | property | Except for displays, options for the object will be held here. | 1 |
views_object:: |
function | Collect this handler's option definition and alter them, ready for use. | ||
views_object:: |
public | function | Views handlers use a special construct function. | 4 |
views_object:: |
public | function | 1 | |
views_object:: |
public | function | ||
views_object:: |
public | function | Always exports the option, regardless of the default value. | |
views_object:: |
public | function | Set default options on this object. | 1 |
views_object:: |
public | function | Set default options. | |
views_object:: |
public | function | Let the handler know what its full definition is. | |
views_object:: |
public | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | |
views_object:: |
public | function | Unpack a single option definition. | |
views_object:: |
public | function | Unpacks each handler to store translatable texts. | |
views_object:: |
public | function | ||
views_plugin:: |
public | property | The current used views display. | |
views_plugin:: |
public | property | The plugin name of this plugin, for example table or full. | |
views_plugin:: |
public | property | The plugin type of this plugin, for example style or query. | |
views_plugin:: |
public | property |
The top object of a view. Overrides views_object:: |
1 |
views_plugin:: |
public | function | Provide a list of additional theme functions for the theme info page. | |
views_plugin:: |
public | function | Handle any special handling on the validate form. | 9 |
views_plugin:: |
public | function | Return the human readable name of the display. | |
views_plugin:: |
public | function | Returns the summary of the settings in the display. | 8 |
views_plugin:: |
public | function | Provide a full list of possible theme templates used by this style. | |
views_plugin_style:: |
public | property | The row plugin, if it's initialized and the style itself supports it. | |
views_plugin_style:: |
public | property | Store all available tokens row rows. | |
views_plugin_style:: |
public | function | Called by the view builder to see if this style handler wants to interfere with the sorts. If so it should build; if it returns any non-TRUE value, normal sorting will NOT be added to the query. | 1 |
views_plugin_style:: |
public | function | Called by the view builder to let the style build a second set of sorts that will come after any other sorts in the view. | 1 |
views_plugin_style:: |
public | function |
Destructor. Overrides views_object:: |
|
views_plugin_style:: |
public | function | Should the output of the style plugin be rendered even if it's empty. | 1 |
views_plugin_style:: |
public | function | Get a rendered field. | |
views_plugin_style:: |
public | function | Get the raw field value. | |
views_plugin_style:: |
public | function | Return the token replaced row class for the specified row. | |
views_plugin_style:: |
public | function | Initialize a style plugin. | |
views_plugin_style:: |
public | function |
Validate the options form. Overrides views_plugin:: |
|
views_plugin_style:: |
public | function | Allow the style to do stuff before each row is rendered. | |
views_plugin_style:: |
public | function |
Add anything to the query that we might need to. Overrides views_plugin:: |
2 |
views_plugin_style:: |
public | function | Render the display in this style. | 5 |
views_plugin_style:: |
public | function | Render all of the fields for a given style and store them on the object. | |
views_plugin_style:: |
public | function | Group records as needed for rendering. | |
views_plugin_style:: |
public | function | Render the grouping sets. | |
views_plugin_style:: |
public | function | Take a value and apply token replacement logic to it. | |
views_plugin_style:: |
public | function | Return TRUE if this style also uses fields. | |
views_plugin_style:: |
public | function | Return TRUE if this style also uses a row plugin. | |
views_plugin_style:: |
public | function | Return TRUE if this style also uses a row plugin. | |
views_plugin_style:: |
public | function | Return TRUE if this style uses tokens. |