<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

class IDVE_Block_Spacer {

    public static function register( IDVE_Blocks $registry ) {
        $registry->register( 'spacer', array(
            'label'    => __( 'Spacer', 'insight-dezign-visual-editor' ),
            'icon'     => 'arrow-down',
            'category' => 'layout',
            'fields'   => array(
                'height' => array( 'type' => 'range', 'label' => __( 'Height (px)', 'insight-dezign-visual-editor' ), 'default' => 40, 'min' => 10, 'max' => 300, 'step' => 5 ),
            ),
            'render' => array( __CLASS__, 'render' ),
        ) );
    }

    public static function render( $data, $settings ) {
        $height = isset( $data['height'] ) ? absint( $data['height'] ) : 40;
        return '<div class="idve-spacer" style="width:100%;height:' . $height . 'px" aria-hidden="true"></div>';
    }
}
