public function SlickManager::build in Slick Carousel 7.3
Same name and namespace in other branches
- 8.2 src/SlickManager.php \Drupal\slick\SlickManager::build()
- 8 src/SlickManager.php \Drupal\slick\SlickManager::build()
Returns a renderable array of both main and thumbnail slick instances.
Parameters
array $build: An associative array containing:
- items: An array of slick contents: text, image or media.
- options: An array of key:value pairs of custom JS overrides.
- optionset: The cached optionset object to avoid multiple invocations.
- settings: An array of key:value pairs of HTML/layout related settings.
- thumb: An associative array of slick thumbnail following the same structure as the main display: $build['thumb']['items'], etc.
Return value
array The renderable array of both main and thumbnail slick instances.
Overrides SlickManagerInterface::build
File
- src/
SlickManager.php, line 449
Class
- SlickManager
- Implements SlickManagerInterface.
Namespace
Drupal\slickCode
public function build(array $build = []) {
foreach (SlickDefault::themeProperties() as $key) {
$build[$key] = isset($build[$key]) ? $build[$key] : [];
}
$settings = $build['settings'];
$cache = [];
if (!empty($settings['cache'])) {
$cache['#cache']['cid'] = $this
->getCacheId($settings);
$cache['#cache']['expire'] = $settings['cache'] == CACHE_TEMPORARY ? CACHE_TEMPORARY : REQUEST_TIME + $settings['cache'];
}
$slick = [
'#theme' => 'slick_wrapper',
'#items' => [],
'#build' => $build,
'#pre_render' => [
'slick_pre_render_wrapper',
],
] + $cache;
drupal_alter('slick_build', $slick, $settings);
return empty($build['items']) ? [] : $slick;
}