function hook_slick_settings_alter in Slick Carousel 8.2
Same name and namespace in other branches
- 8 slick.api.php \hook_slick_settings_alter()
- 7.3 slick.api.php \hook_slick_settings_alter()
Modifies Slick HTML settings before being passed to preprocess, or templates.
If you need to override globally to be inherited by all blazy-related modules: slick, gridstack, mason, etc., consider hook_blazy_settings_alter().
Parameters
array $build: The array containing: item, content, settings, or optional captions.
object $items: The \Drupal\Core\Field\FieldItemListInterface items.
See also
\Drupal\blazy\BlazyFormatterManager::buildSettings()
\Drupal\slick\SlickFormatter::buildSettings()
Related topics
1 invocation of hook_slick_settings_alter()
- SlickFormatter::preBuildElements in src/
SlickFormatter.php - Modifies the field formatter settings inherited by child elements.
File
- ./
slick.api.php, line 557 - Hooks and API provided by the Slick module.
Code
function hook_slick_settings_alter(array &$build, $items) {
$settings =& $build['settings'];
// See blazy_blazy_settings_alter() at blazy.module for existing samples.
// First check the $settings array. Slick Views may have different array.
if (isset($settings['entity_id'])) {
// Change skin if meeting a particular criteria.
if ($settings['optionset'] == 'x_slick_for') {
$settings['skin'] = $settings['entity_id'] == 54 ? 'fullwidth' : $settings['skin'];
}
// Swap optionset at particular pages.
if (in_array($settings['entity_id'], [
54,
64,
74,
])) {
$settings['optionset'] == 'my_slick_pages';
}
}
}