class views_flag_refresh_plugin_display_extender in Views Flag Refresh 7
This plugin adds additional settings to the Views AJAX options.
Hierarchy
- class \views_object
- class \views_plugin
Expanded class hierarchy of views_flag_refresh_plugin_display_extender
1 string reference to 'views_flag_refresh_plugin_display_extender'
- views_flag_refresh_views_plugins in ./
views_flag_refresh.views.inc - Implements hook_views_plugins().
File
- ./
views_flag_refresh_plugin_display_extender.inc, line 13 - Views field view field handler class.
View source
class views_flag_refresh_plugin_display_extender extends views_plugin_display_extender {
/**
* List of new options added by plugin.
*/
protected function add_options(&$options = array()) {
$options['use_ajax_flags'] = array(
'default' => FALSE,
);
$options['use_ajax_flags_noscrolltop'] = array(
'default' => 0,
);
$options['use_ajax_flags_widget'] = array(
'default' => 'default',
);
}
/**
* Provide a form to edit options for this plugin.
*
* Added in Views 3.5.
*/
function options_definition_alter(&$options = array()) {
$this
->add_options($options);
}
/**
* Provide a form to edit options for this plugin.
*
* Used in Views prior to 3.5.
*/
function option_definition(&$options = array()) {
$this
->add_options($options);
return $options;
}
/**
* Provide the form to set new option.
*/
function options_form(&$form, &$form_state) {
switch ($form_state['section']) {
case 'views_flag_refresh':
$form['use_ajax_flags'] = array(
'#type' => 'checkboxes',
'#title' => t('Refresh display on flags'),
'#options' => views_flag_refresh_flag_options_get(),
'#default_value' => (array) $this->display
->get_option('use_ajax_flags'),
'#description' => t('Refreshes the display via AJAX whenever a user clicks one of the selected flags. This will only take effect if the <em>Use AJAX</em> option is set to <em>Yes</em>.'),
);
$form['use_ajax_flags_noscrolltop'] = array(
'#type' => 'checkbox',
'#title' => t('Disable scroll to top of this view.'),
'#default_value' => $this->display
->get_option('use_ajax_flags_noscrolltop'),
'#description' => t('Check if you want disable scroll to the top of this view after AJAX update.'),
);
$default_value = $this->display
->get_option('use_ajax_flags_widget');
$form['use_ajax_flags_widget'] = array(
'#type' => 'radios',
'#title' => t('Refresh widget'),
'#options' => views_flag_refresh_widget_options_get(),
'#default_value' => $default_value ? $default_value : 'default',
'#description' => t('The widget alters the display of the view as it is refreshing, for example by adding a throbber or textual message.'),
);
break;
}
}
/**
* Inserts the code into the view display.
*/
function options_submit(&$form, &$form_state) {
switch ($form_state['section']) {
case 'views_flag_refresh':
$this->display
->set_option('use_ajax_flags', $form_state['values']['use_ajax_flags']);
$this->display
->set_option('use_ajax_flags_noscrolltop', $form_state['values']['use_ajax_flags_noscrolltop']);
$this->display
->set_option('use_ajax_flags_widget', $form_state['values']['use_ajax_flags_widget']);
break;
}
}
/**
* Summarizes new option.
*
* Lists the fields as either 'Yes' if there is text or 'None' otherwise and
* categorizes the fields under the 'Other' category.
*/
function options_summary(&$categories, &$options) {
$flags = $this->display
->get_option('use_ajax_flags');
$flags_selected = array();
if (is_array($flags)) {
$flags_names = views_flag_refresh_flag_options_get();
foreach ($flags as $flag) {
if ($flag) {
$flags_selected[] = $flags_names[$flag];
}
}
}
if ($flags_selected) {
$flags_selected = implode(', ', $flags_selected);
}
else {
$flags_selected = t('None');
}
$options['views_flag_refresh'] = array(
'category' => 'other',
'title' => t('Flag refresh'),
'value' => $flags_selected,
'desc' => t('Choose flags that can refresh display.'),
);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
views_flag_refresh_plugin_display_extender:: |
protected | function | List of new options added by plugin. | |
views_flag_refresh_plugin_display_extender:: |
function |
Provide a form to edit options for this plugin. Overrides views_plugin_display_extender:: |
||
views_flag_refresh_plugin_display_extender:: |
function |
Provide the form to set new option. Overrides views_plugin_display_extender:: |
||
views_flag_refresh_plugin_display_extender:: |
function |
Inserts the code into the view display. Overrides views_plugin_display_extender:: |
||
views_flag_refresh_plugin_display_extender:: |
function |
Summarizes new option. Overrides views_plugin_display_extender:: |
||
views_flag_refresh_plugin_display_extender:: |
function |
Provide a form to edit options for this plugin. Overrides views_object:: |
||
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 | Destructor. | 2 |
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 | 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:: |
public | function | Validate that the plugin is correct and can be saved. | 3 |
views_plugin_display_extender:: |
public | function | Static member function to list which sections are defaultable and what items each section contains. | |
views_plugin_display_extender:: |
public | function | ||
views_plugin_display_extender:: |
public | function |
Validate the options form. Overrides views_plugin:: |
|
views_plugin_display_extender:: |
public | function | Set up any variables on the view prior to execution. | |
views_plugin_display_extender:: |
public | function |
Inject anything into the query that the display_extender handler needs. Overrides views_plugin:: |