rtForm::enclose_label PHP Method

enclose_label() protected method

Enclose html label.
protected enclose_label ( $element, $html, $label, boolean $class = false ) : string
$element
$html
$label
$class boolean
return string
        protected function enclose_label($element, $html, $label, $class = false)
        {
            $labelClass = '';
            if (!empty($class) && is_array($class)) {
                $labelClass = 'class="' . esc_attr(implode(' ', $class)) . '"';
            }
            $data = '<label for="' . esc_attr($this->element_id) . '" ' . $labelClass . '>';
            if ('rtRadio' === $element || 'rtCheckbox' === $element) {
                $data .= $html . ' ' . $label;
            } else {
                $data .= $label . ' ' . $html;
            }
            $data .= '</label>';
            return $data;
        }

Usage Example

Exemplo n.º 1
0
 protected function generate_dimensions($attributes)
 {
     $element = "rtDimension";
     global $rtmedia;
     $defaults = array('desc' => '', 'show_desc' => false);
     $attributes = wp_parse_args($attributes, $defaults);
     extract($attributes);
     $html = '<div ';
     if (isset($attributes['id'])) {
         $html .= 'id="' . $attributes['id'] . '" ';
     } else {
         $html .= 'id="' . $this->get_default_class() . '-' . $this->get_default_id() . '" ';
         $this->update_default_id();
     }
     if (isset($attributes['class'])) {
         $html .= self::embedd_class($element, $attributes['class']);
     } else {
         $html .= self::embedd_class($element);
     }
     $html .= '>';
     $html .= parent::get_textbox(array('name' => "rtmedia-options[{$key}_width]", 'value' => $width, 'class' => array("small-text large-offset-1"), 'show_desc' => $show_desc));
     if (isset($height)) {
         $html .= parent::get_textbox(array('name' => "rtmedia-options[{$key}_height]", 'value' => $height, 'class' => array("small-text large-offset-1"), 'show_desc' => $show_desc));
     }
     if (isset($crop)) {
         $html .= parent::get_checkbox(array('name' => "rtmedia-options[{$key}_crop]", 'rtForm_options' => array(array('' => 1, 'checked' => $crop)), 'class' => array("large-offset-1"), 'show_desc' => $show_desc));
     }
     if ($desc && $show_desc) {
         $html .= '<span class="clearfix large-offset-3 description">' . $desc . '</span>';
     }
     $html .= '</div>';
     if (isset($attributes['label'])) {
         $html = parent::enclose_label('container', $html, $attributes['label']);
     }
     return $html;
 }
All Usage Examples Of rtForm::enclose_label