<?php
    namespace Pixebuilder\Element;
    
    // prevent direct file access
	if( !defined( 'ABSPATH' ) ) exit;

class Text_Box extends Item{

        static function get_name(){
            return 'text-box';
        }
        
        static function get_default(){
            return array(
                'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>'
            );
        }

        static function get_title(){
            return esc_html__('Text Box', 'pixebuilder');
        }

        static function get_icon(){
            return 'content';
        }
        
        static function render_content($settings){
            $ret = '';

            if( !empty($settings['content']) ){

                // data attributes
                $atts = array();
                if( !empty($settings['content-typo']['preset']) ){
                    $atts['typo-preset'] = $settings['content-typo']['preset'];
                }

                // background filter
                if( !empty($settings['background']) ){
                    pixe_set_background_color_filter($settings['background']);
                }

                $ret .= '<div class="pixe-inline" '; 
                $ret .= pixe_get_data_atts($atts);
                $ret .= '>';
                $ret .= do_shortcode($settings['content']);
                $ret .= '</div>';
            }
            return $ret;
        }

    }

    \Pixe_Builder::register_element('Pixebuilder\Element\Text_Box');
    