class PagerFields in Views Slideshow 8.4
Provides a pager using fields.
Plugin annotation
@ViewsSlideshowWidget(
id = "views_slideshow_pager_fields",
type = "views_slideshow_pager",
label = @Translation("Fields"),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\views_slideshow\ViewsSlideshowWidgetBase implements ViewsSlideshowWidgetInterface uses StringTranslationTrait
- class \Drupal\views_slideshow\Plugin\ViewsSlideshowWidget\PagerFields
- class \Drupal\views_slideshow\ViewsSlideshowWidgetBase implements ViewsSlideshowWidgetInterface uses StringTranslationTrait
Expanded class hierarchy of PagerFields
File
- src/
Plugin/ ViewsSlideshowWidget/ PagerFields.php, line 17
Namespace
Drupal\views_slideshow\Plugin\ViewsSlideshowWidgetView source
class PagerFields extends ViewsSlideshowWidgetBase {
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'views_slideshow_pager_fields_fields' => [
'default' => [],
],
'views_slideshow_pager_fields_hover' => [
'default' => 0,
],
];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
// Settings for fields pager.
$options = [];
// Get each field and it's name.
foreach ($this
->getConfiguration()['view']->display_handler
->getHandlers('field') as $field_name => $field) {
$options[$field_name] = $field
->adminLabel();
}
// Need to wrap this so it indents correctly.
$form['views_slideshow_pager_fields_wrapper'] = [
'#markup' => '<div class="vs-dependent">',
];
// Add ability to choose which fields to show in the pager.
$form['views_slideshow_pager_fields_fields'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Pager fields'),
'#options' => $options,
'#default_value' => $this
->getConfiguration()['views_slideshow_pager_fields_fields'],
'#description' => $this
->t('Choose the fields that will appear in the pager.'),
'#states' => [
'visible' => [
':input[name="' . $this
->getConfiguration()['dependency'] . '[enable]"]' => [
'checked' => TRUE,
],
':input[name="' . $this
->getConfiguration()['dependency'] . '[type]"]' => [
'value' => 'views_slideshow_pager_fields',
],
],
],
];
// Add field to see if they would like to activate slide and pause on pager
// hover.
$form['views_slideshow_pager_fields_hover'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Activate Slide and Pause on Pager Hover'),
'#default_value' => $this
->getConfiguration()['views_slideshow_pager_fields_hover'],
'#description' => $this
->t('Should the slide be activated and paused when hovering over a pager item.'),
'#states' => [
'visible' => [
':input[name="' . $this
->getConfiguration()['dependency'] . '[enable]"]' => [
'checked' => TRUE,
],
':input[name="' . $this
->getConfiguration()['dependency'] . '[type]"]' => [
'value' => 'views_slideshow_pager_fields',
],
],
],
];
$form['views_slideshow_pager_fields_wrapper_close'] = [
'#markup' => '</div>',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function checkCompatiblity($view) {
return $view
->getStyle()
->usesFields();
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PagerFields:: |
public | function |
Form constructor. Overrides ViewsSlideshowWidgetBase:: |
|
PagerFields:: |
public | function |
Check if the widget is compatible with the current view configuration. Overrides ViewsSlideshowWidgetBase:: |
|
PagerFields:: |
public | function |
Gets default configuration for this plugin. Overrides ViewsSlideshowWidgetBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
ViewsSlideshowWidgetBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
ViewsSlideshowWidgetBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
ViewsSlideshowWidgetBase:: |
public | function | ||
ViewsSlideshowWidgetBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
ViewsSlideshowWidgetBase:: |
public | function |
Form submission handler. Overrides PluginFormInterface:: |
|
ViewsSlideshowWidgetBase:: |
public | function |
Form validation handler. Overrides PluginFormInterface:: |
|
ViewsSlideshowWidgetBase:: |
public | function |
Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: |