class views_quicksand_style_plugin in Views Quicksand 7
Implementation of views_plugin_style().
Hierarchy
- class \views_object
- class \views_plugin
- class \views_plugin_style
- class \views_quicksand_style_plugin
- class \views_plugin_style
- class \views_plugin
Expanded class hierarchy of views_quicksand_style_plugin
1 string reference to 'views_quicksand_style_plugin'
- views_quicksand_views_plugins in ./
views_quicksand.views.inc - Implements hook_views_plugin().
File
- ./
views_quicksand_style_plugin.inc, line 12 - Provide an accordion style plugin for Views. This file is autoloaded by views.
View source
class views_quicksand_style_plugin extends views_plugin_style {
/**
* Set default options
*/
function option_definition() {
$options = parent::option_definition();
$options['adjustHeight'] = array(
'default' => 'auto',
);
$options['element'] = array(
'default' => 'views-row',
);
$options['attribute'] = array(
'default' => 'data-id',
);
$options['duration'] = array(
'default' => 750,
);
$options['easing'] = array(
'default' => 'swing',
);
$options['css'] = array(
'default' => '1',
);
/*
* @TODO:
* Provide support for missing quicksand options:
* enhancement
* useScaling
*
* See http://razorjack.net/quicksand/docs-and-demos.html
*/
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$heightOptions = array(
'auto' => t('Auto'),
'dynamic' => t('Dynamic'),
'false' => t('False'),
);
$form['adjustHeight'] = array(
'#type' => 'select',
'#title' => t('Adjust height'),
'#default_value' => $this->options['adjustHeight'],
'#description' => t("Adjusts the height of container to fit all the " . "items, 'auto' for automatically adjusting before or after " . "the animation (determined automatically), 'dynamic' for " . "height adjustment animation, false for keeping the height " . "constant."),
'#options' => $heightOptions,
);
$form['element'] = array(
'#type' => 'textfield',
'#title' => t('ID Element'),
'#default_value' => $this->options['element'],
'#description' => t('Specify which element contains the attribute that identifies your ' . 'distinct elements. This is any valid jquery selector whose search ' . 'will be scoped inside your view.'),
);
$form['attribute'] = array(
'#type' => 'textfield',
'#title' => t('ID attribute'),
'#default_value' => $this->options['attribute'],
'#description' => t('Attribute used to match items in collections. ' . 'This can be the id or class attribute or even a custom ' . 'attribute like data-id, which you would have to integrate ' . 'manually into your view results.'),
);
$form['duration'] = array(
'#type' => 'textfield',
'#title' => t('Duration'),
'#default_value' => $this->options['duration'],
'#description' => t('How long the animation will take. In milliseconds..'),
);
$form['easing'] = array(
'#type' => 'hidden',
'#default_value' => $this->options['easing'],
);
$form['easing_select'] = array(
'#type' => 'select',
'#title' => t('Easing animation'),
'#description' => t("Select the animation to use for transitions.") . t("For examples how these easings will behave, have a look at !link", array(
'!link' => l('jQuery UI easing', 'http://jqueryui.com/demos/effect/#easing'),
)),
'#attached' => array(
'js' => array(
drupal_get_path('module', 'views_quicksand') . '/views_quicksand_settings.js',
),
),
);
$form['css'] = array(
'#type' => 'checkbox',
'#title' => t('Use default css'),
'#default_value' => $this->options['css'],
'#description' => t("By default Views Quicksand defines a few styles to" . " make your view results look like a grid. You can disable " . "this behaviour here."),
);
}
/**
* Render the display in this style.
*/
function render() {
$output = parent::render();
// Add the javascript for quicksand if it exists in the correct place.
if ($path = libraries_get_path('jquery.quicksand')) {
if (file_exists($path . '/jquery.quicksand.js')) {
drupal_add_js($path . '/jquery.quicksand.js');
}
else {
// Otherwise inform the user that the library couldn't be located.
drupal_set_message('The jQuery Quicksand library is missing under path: "' . $path . '/jquery.quicksand.js"', 'error');
}
}
drupal_add_library('system', 'effects');
// Scope our javascript to the footer to allow us to access Drupal.settings
// before document ready has fired.
$path = drupal_get_path('module', 'views_quicksand');
drupal_add_js($path . '/views_quicksand.js', array(
'scope' => 'footer',
));
// add css
if ($this->options['css'] == true) {
drupal_add_css($path . '/views_quicksand.css');
}
// Preparing the js variables and adding the js to our display.
$view_settings['adjustHeight'] = $this->options['adjustHeight'];
$view_settings['element'] = $this->options['element'];
$view_settings['attribute'] = $this->options['attribute'];
$view_settings['duration'] = $this->options['duration'];
$view_settings['easing'] = $this->options['easing'];
$view_settings['display'] = $this->view->current_display;
$view_settings['viewname'] = $this->view->name;
if (isset($this->view->dom_id)) {
$view_settings['dom_id'] = $this->view->dom_id;
}
$view_settings['row_plugin'] = get_class($this->row_plugin);
$quicksand_id = 'views-quicksand-' . $this->view->name . '-' . $this->view->current_display;
drupal_add_js(array(
'views_quicksand' => array(
$quicksand_id => $view_settings,
),
), 'setting');
return $output;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 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. | |
views_plugin_style:: |
public | function |
Validate that the plugin is correct and can be saved. Overrides views_plugin:: |
|
views_quicksand_style_plugin:: |
function |
Provide a form to edit options for this plugin. Overrides views_plugin_style:: |
||
views_quicksand_style_plugin:: |
function |
Set default options Overrides views_plugin_style:: |
||
views_quicksand_style_plugin:: |
function |
Render the display in this style. Overrides views_plugin_style:: |