public function SlickFormatter::buildSettings in Slick Carousel 8
Same name and namespace in other branches
- 8.2 src/SlickFormatter.php \Drupal\slick\SlickFormatter::buildSettings()
- 7.3 src/SlickFormatter.php \Drupal\slick\SlickFormatter::buildSettings()
File
- src/
SlickFormatter.php, line 17
Class
- SlickFormatter
- Implements SlickFormatterInterface.
Namespace
Drupal\slickCode
public function buildSettings(array &$build, $items) {
$settings =& $build['settings'];
// Prepare integration with Blazy.
$settings['item_id'] = 'slide';
$settings['namespace'] = 'slick';
// Pass basic info to parent::buildSettings().
parent::buildSettings($build, $items);
// Slick specific stuffs.
$build['optionset'] = Slick::load($settings['optionset']);
// Ensures deleted optionset while being used doesn't screw up.
if (empty($build['optionset'])) {
$build['optionset'] = Slick::load('default');
}
if (!isset($settings['nav'])) {
$settings['nav'] = !empty($settings['optionset_thumbnail']) && isset($items[1]);
}
// Do not bother for SlickTextFormatter, or when vanilla is on.
if (empty($settings['vanilla'])) {
$lazy = $build['optionset']
->getSetting('lazyLoad');
$settings['blazy'] = $lazy == 'blazy' || !empty($settings['blazy']);
$settings['lazy'] = $settings['blazy'] ? 'blazy' : $lazy;
if (empty($settings['blazy'])) {
$settings['lazy_class'] = $settings['lazy_attribute'] = 'lazy';
}
}
else {
// Nothing to work with Vanilla on, disable the asnavfor, else JS error.
$settings['nav'] = FALSE;
}
// Only trim overridables options if disabled.
if (empty($settings['override']) && isset($settings['overridables'])) {
$settings['overridables'] = array_filter($settings['overridables']);
}
}