$this->attributes(), 'render_callback' => [$this, 'render'] ) ); } function attributes(){ return array( 'align' => array( 'type' => 'string', 'default' => '' ), 'cId' => array( 'type' => 'string', 'default' => '' ), 'playerAlign' => array( 'type' => 'string', 'default' => 'center' ), 'file' => array( 'type' => 'string', 'default' => 'https://assets4.lottiefiles.com/datafiles/zc3XRzudyWE36ZBJr7PIkkqq0PFIrIBgp4ojqShI/newAnimation.json' ), 'isControls' => array( 'type' => 'boolean', 'default' => true ), 'isAutoplay' => array( 'type' => 'boolean', 'default' => true ), 'isLoop' => array( 'type' => 'boolean', 'default' => true ), 'isHover' => array( 'type' => 'boolean', 'default' => false ), 'mode' => array( 'type' => 'string', 'default' => 'normal' ), 'count' => array( 'type' => 'number', 'default' => 0 ), 'speed' => array( 'type' => 'number', 'default' => 1 ), 'intermission' => array( 'type' => 'number', 'default' => 0 ), 'width' => array( 'type' => 'string', 'default' => '450px' ), 'background' => array( 'type' => 'string', 'default' => '#0000' ), 'controlsHeight' => array( 'type' => 'string', 'default' => '35px' ), 'controlsBG' => array( 'type' => 'string', 'default' => '#0000' ), 'controlsIconColor' => array( 'type' => 'string', 'default' => '#4527a4' ), 'controlsIconHoverColor' => array( 'type' => 'string', 'default' => '#8344c5' ), 'controlsIconActiveColor' => array( 'type' => 'string', 'default' => '#8344c5' ), 'controlsTrackColor' => array( 'type' => 'string', 'default' => '#8344c5' ), 'controlsThumbColor' => array( 'type' => 'string', 'default' => '#4527a4' ) ); } function render( $attributes ){ extract( $attributes ); // Generate Styles $lottiePlayerStyle = new BBlocksStyleGenerator(); $lottiePlayerStyle::addStyle( "#bBlocksLottiePlayer-$cId .bBlocksLottiePlayer", array( 'text-align' => $playerAlign ) ); $lottiePlayerStyle::addStyle( "#bBlocksLottiePlayer-$cId .bBlocksLottiePlayer lottie-player", array( 'width' => $width, '--lottie-player-toolbar-height' => $controlsHeight, '--lottie-player-toolbar-background-color' => $controlsBG, '--lottie-player-toolbar-icon-color' => $controlsIconColor, '--lottie-player-toolbar-icon-hover-color' => $controlsIconHoverColor, '--lottie-player-toolbar-icon-active-color' => $controlsIconActiveColor, '--lottie-player-seeker-track-color' => $controlsTrackColor, '--lottie-player-seeker-thumb-color' => $controlsThumbColor ) ); $jsonData = json_encode( array( 'isControls' => $isControls, 'isAutoplay' => $isAutoplay, 'isLoop' => $isLoop, 'isHover' => $isHover ) ); ob_start(); ?>
' id='bBlocksLottiePlayer-' data-controls=''>