Пример #1
0
 function st_handle_icon_tag($class, $required_handle_class = true, $holder = "i")
 {
     if ($required_handle_class) {
         $class = st_handle_icon_class($class);
     }
     if ($class) {
         return "<" . $holder . ' class="' . $class . '"></' . $holder . '>';
     }
 }
Пример #2
0
    function st_checkout_fieldtype_textarea($field_name, $field)
    {
        $default = array('label' => '', 'placeholder' => '', 'class' => array('form-control'), 'type' => 'text', 'size' => 6, 'icon' => '', 'validate' => '', 'attrs' => array());
        $field = wp_parse_args($field, $default);
        extract($field);
        if (!$placeholder) {
            $placeholder = $label;
        }
        $required = false;
        if (strpos($validate, 'required') !== FALSE) {
            $class[] = 'required';
            $required = '<span class="require">*</span>';
        }
        if ($icon) {
            $icon = "<i class='" . st_handle_icon_class($icon) . " input-icon'></i>";
        }
        $attrs_str = false;
        if (is_array($attrs) and !empty($attrs)) {
            foreach ($attrs as $key => $value2) {
                $attrs_str .= " {$key}='" . esc_attr($value2) . "'";
            }
        }
        ob_start();
        ?>
        <div class="col-sm-<?php 
        echo esc_attr($size);
        ?>
">

            <div class="form-group <?php 
        if ($icon) {
            echo 'form-group-icon-left';
        }
        ?>
">
                
                <label for="field-<?php 
        echo esc_attr($field_name);
        ?>
"><?php 
        echo balanceTags($label);
        ?>
 <?php 
        echo balanceTags($required);
        ?>
 </label>
                <?php 
        echo balanceTags($icon);
        ?>

                <textarea <?php 
        echo $attrs_str;
        ?>
 class="<?php 
        echo implode(' ', $class);
        ?>
" id="field-<?php 
        echo esc_attr($field_name);
        ?>
"  name="<?php 
        echo esc_attr($field_name);
        ?>
" placeholder="<?php 
        echo esc_attr($placeholder);
        ?>
"><?php 
        echo $value;
        ?>
</textarea>
            </div>

        </div>
        <?php 
        $html = @ob_get_clean();
        return $html;
    }