class MixitupViewsDefaultOptionsService in MixItUp Views 8
Same name and namespace in other branches
- 8.2 src/MixitupViewsDefaultOptionsService.php \Drupal\mixitup_views\MixitupViewsDefaultOptionsService
Class MixitupViewsDefaultOptions.
@package Drupal\mixitup_views
Hierarchy
- class \Drupal\mixitup_views\MixitupViewsDefaultOptionsService
Expanded class hierarchy of MixitupViewsDefaultOptionsService
3 files declare their use of MixitupViewsDefaultOptionsService
- MixItUpDefaultOptionsServiceTest.php in tests/
src/ Unit/ MixItUpDefaultOptionsServiceTest.php - MixitUpFiltersFormTest.php in tests/
src/ Kernel/ MixitUpFiltersFormTest.php - MixItUpFuncTest.php in tests/
src/ Kernel/ MixItUpFuncTest.php
1 string reference to 'MixitupViewsDefaultOptionsService'
1 service uses MixitupViewsDefaultOptionsService
File
- src/
MixitupViewsDefaultOptionsService.php, line 10
Namespace
Drupal\mixitup_viewsView source
class MixitupViewsDefaultOptionsService {
/**
* Get default option for mixitup js.
*
* @return array
* Array of default mixitup params.
*/
public function defaultOptions($convert = FALSE) {
$options = [
'selectors' => [
'target' => '.mix',
'filter' => '.filter',
'sort' => '.sort',
],
'load' => [
'filter' => 'all',
'sort' => 'default:asc',
],
'animation' => [
'enable' => TRUE,
'effects' => 'fade scale',
'duration' => 600,
'easing' => 'ease',
'perspectiveDistance' => '3000px',
'perspectiveOrigin' => '50% 50%',
'queue' => TRUE,
'queueLimit' => 1,
],
'restrict' => [
'vocab' => FALSE,
'vocab_ids' => [],
],
];
if ($convert) {
$options = $this
->convertFromMixitupOptions($options);
}
return $options;
}
/**
* Convert mixitup options array to needed.
*
* @param array $mixitup_options
* Options array in mixitup js style.
*
* @return array
* Converted array of mixitup params.
*/
public function convertFromMixitupOptions(array $mixitup_options) {
$converted_options = [];
foreach ($mixitup_options as $cat => $options) {
foreach ($options as $option => $default_value) {
$converted_options[$cat . '_' . $option] = $default_value;
}
}
return $converted_options;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MixitupViewsDefaultOptionsService:: |
public | function | Convert mixitup options array to needed. | |
MixitupViewsDefaultOptionsService:: |
public | function | Get default option for mixitup js. |