Im following your guide and downloaded the Sample Extension which I’m playing around currently (after resolving the in build error - you guys should take a look to deliver an error free example).
I want to find out how to implement the animation to my own element. “my-second-element” contains already the controls.php named ‘image_animation’ which also shows up in the fronted. So far so good. But this isn’t used in the shortcode.php code (as well as the date picker). So how to use it to animate my element? Just echo the var ‘$image_animation’ doesn’t do the trick ;( Obviously it’s not that simple. So I peeked into the feature box shortcode and tried the following:
<?php
// shortcode.php
$classes = array( 'my-second-element' );
$classes[] = $features;
$js_params = array(
'child' => 'false',
'graphicAnimation' => $image_animation
);
$anim_data = cs_generate_data_attributes( 'my-second-element', $js_params );
$elem_atts = cs_atts( array( 'id' => $id, 'class' => implode( ' ', $classes ), 'style' => $style ), false );
echo "
<div {$anim_data} {$elem_atts}>
<img src='{$image}' style='padding: {$image_padding}'>
<p>{$content}</p>
</div>
";
?>
Ok, I changed the output to be more readable but this should do. But the animation par doesn’t work. So I tried var_dump($image_animation) just to see what’s inside - but it ouputs just NULL! Well, is this part of the API working at all?
Ok, my second try with manual params:
<?php
// shortcode.php
$classes = array( 'my-second-element' );
$classes[] = $features;
$js_params = array(
'child' => 'false',
'graphicAnimation' => 'flipInX',
'graphicAnimationOffset' => '65',
'graphicAnimationDelay' => '1500',
);
$anim_data = cs_generate_data_attributes( 'my-second-element', $js_params );
$elem_atts = cs_atts( array( 'id' => $id, 'class' => implode( ' ', $classes ), 'style' => $style ), false );
echo "
<div {$anim_data} {$elem_atts}>
<img src='{$image}' style='padding: {$image_padding}'>
<p>{$content}</p>
</div>
";
?>
But it doesn’t work as well. I guess it should be possible somehow. Please tell me how to do it correctly.