*/ class Aior_Builder { /** * Initialize the class and set its properties. * * @since 1.0.0 */ public function __construct() { } /** * Add the Fields in the form. * * @since 1.0.0 * @param array $args Passes the type, name, etc as arguments. */ public function add_field( $args ) { $args = self::fixed_empty_array( $args ); //phpcs:ignore if ( array_key_exists( 'type', $args ) ) { $type = $args ['type']; if ( 'text' === $type ) { echo self::field_type_text( $args ); //phpcs:ignore } if ( 'date' === $type ) { echo self::field_type_date( $args ); //phpcs:ignore } if ( 'email' === $type ) { echo self::field_type_email( $args ); //phpcs:ignore } if ( 'textarea' === $type ) { echo self::field_type_textarea( $args ); //phpcs:ignore } if ( 'hidden' === $type ) { echo self::field_type_hidden( $args ); //phpcs:ignore } if ( 'number' === $type ) { echo self::field_type_number( $args ); //phpcs:ignore } if ( 'select' === $type ) { echo self::field_type_select( $args ); //phpcs:ignore } if ( 'radio' === $type ) { echo self::field_type_radio( $args ); //phpcs:ignore } if ( 'checkbox' === $type ) { echo self::field_type_checkbox( $args ); //phpcs:ignore } if ( 'wp_editor' === $type ) { wp_editor( $args['value'], $args['id'], $args['settings'] ); } if ( 'color_picker' === $type ) { echo self::field_type_color_picker( $args ); //phpcs:ignore } if ( 'radio_image' === $type ) { echo self::field_type_radio_image( $args ); //phpcs:ignore } } } /** * Fix the empty array. * * @since 1.0.0 * @param array $args Passes the type, name, etc as arguments. */ public static function fixed_empty_array( $args ) { $default = array( 'type' => '', 'id' => '', 'class' => '', 'name' => '', 'value' => '', 'option' => '', 'default' => '', 'placeholder' => '', 'required' => '', 'min' => '', 'max' => '', 'selected' => '', 'rows' => '', 'cols' => '', 'style' => '', 'settings' => '', 'attr' => '', 'width' => '', 'height' => '', ); return array_merge( $default, $args ); } /** * Retrieve the atributs. * * @since 1.0.0 * @param array $args Stores the key-value pair. */ public static function get_attr( $args ) { if ( ! empty( $args ['attr'] ) ) { $html = ''; foreach ( $args ['attr'] as $key => $value ) { $html .= ' ' . $key . '="' . $value . '"'; } return $html; } } /** * Field Type is Color Picker. * * @since 1.0.0 * @param array $args Passes the Whole HTML with attributes. */ public static function field_type_color_picker( $args ) { $class = ''; $html = ' $value ) { $html .= ''; } $html .= ''; } else { $html .= '