public static function ParallaxBgModifier::modification in Modifiers Pack 8
1 call to ParallaxBgModifier::modification()
- ParallaxBgModifierTest::testModification in modules/
modifiers_bg_parallax/ tests/ src/ Unit/ ParallaxBgModifierTest.php - @covers ::modification
File
- modules/
modifiers_bg_parallax/ src/ Plugin/ modifiers/ ParallaxBgModifier.php, line 22
Class
- ParallaxBgModifier
- Provides a Modifier to set the parallax background on an element.
Namespace
Drupal\modifiers_bg_parallax\Plugin\modifiersCode
public static function modification($selector, array $config) {
if (!empty($config['parallax'])) {
$media = parent::getMediaQuery($config);
$args['image'] = $config['parallax'];
if (!empty($config['parallax_speed'])) {
$args['speed'] = (double) $config['parallax_speed'];
}
if (!empty($config['bgp_color_val'])) {
$args['color'] = $config['bgp_color_val'];
}
$libraries = [
'modifiers_bg_parallax/apply',
];
$settings = [
'namespace' => 'ParallaxBgModifier',
'callback' => 'apply',
'selector' => $selector,
'media' => $media,
'args' => $args,
];
$attributes[$media][$selector]['class'][] = 'modifiers-has-background';
return new Modification([], $libraries, $settings, $attributes);
}
return NULL;
}