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 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;
 }
Example #2
0
 /**
  * Generate rtmedia dimensions in admin options.
  *
  * @access protected
  *
  * @param  array $attributes
  *
  * @return string $html
  */
 protected function generate_dimensions($attributes)
 {
     $element = 'rtDimension';
     global $rtmedia;
     $options = $rtmedia->options;
     $defaults = array('desc' => '', 'show_desc' => false);
     $attributes = wp_parse_args($attributes, $defaults);
     extract($attributes);
     $html = '';
     $html .= '<td>' . parent::get_number(array('name' => "rtmedia-options[{$key}_width]", 'value' => $width, 'class' => array('small-text large-offset-1'), 'show_desc' => $show_desc)) . '</td>';
     if (isset($height)) {
         $html .= '<td>' . parent::get_number(array('name' => "rtmedia-options[{$key}_height]", 'value' => $height, 'class' => array('small-text large-offset-1'), 'show_desc' => $show_desc)) . '</td>';
     }
     if (isset($crop)) {
         $html .= '<td>' . parent::get_switch(array('name' => "rtmedia-options[{$key}_crop]", 'rtForm_options' => array(array('' => 1, 'checked' => $crop)), 'value' => isset($options["rtmedia-options[{$key}_crop]"]) ? $options["rtmedia-options[{$key}_crop]"] : '0', 'show_desc' => $show_desc)) . '</td>';
     }
     if ($desc && $show_desc) {
         $html .= '<span class="clearfix large-offset-3 description">' . esc_html($desc) . '</span>';
     }
     if (isset($attributes['label'])) {
         $html = parent::enclose_label('container', $html, $attributes['label']);
     }
     return $html;
 }