render_attributes() public static method

Renders an attribute array into an html attributes string
public static render_attributes ( array $attributes ) : string
$attributes array
return string
Exemplo n.º 1
0
 /**
  * @see Walker::start_el()
  *
  * @param string $output            Passed by reference. Used to append additional content.
  * @param object $object            Item data object.
  * @param int    $depth             Depth of item.
  * @param int    $current_object_id Item ID.
  * @param array  $args
  */
 public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $label = $this->db_fields['label'];
     $id = $this->db_fields['id'];
     $attributes = RWMB_Field::call('get_attributes', $this->field, $object->{$id});
     $output .= sprintf('<li><label><input %s %s>%s</label>', RWMB_Field::render_attributes($attributes), checked(in_array($object->{$id}, $this->meta), 1, false), $object->{$label});
 }
 /**
  * @see Walker::start_el()
  *
  * @param string $output            Passed by reference. Used to append additional content.
  * @param object $object            Item data object.
  * @param int    $depth             Depth of item.
  * @param int    $current_object_id Item ID.
  * @param array  $args
  */
 public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $label = $this->db_fields['label'];
     $id = $this->db_fields['id'];
     $meta = $this->meta;
     $field = $this->field;
     $field_class = RW_Meta_Box::get_class_name($field);
     $attributes = call_user_func(array($field_class, 'get_attributes'), $field, $object->{$id});
     $output .= sprintf('<li><label><input %s %s>%s</label>', RWMB_Field::render_attributes($attributes), checked(in_array($object->{$id}, $meta), 1, false), $object->{$label});
 }
Exemplo n.º 3
0
 function display_level($options, $parent_id = 0, $active = false)
 {
     $id = $this->db_fields['id'];
     $field = $this->field;
     $walker = new RWMB_Walker_Select($this->db_fields, $field, $this->meta);
     $attributes = RWMB_Field::call('get_attributes', $field, $this->meta);
     $children = $options[$parent_id];
     $output = sprintf('<div class="rwmb-select-tree %s" data-parent-id="%s"><select %s>', $active ? '' : 'hidden', $parent_id, RWMB_Field::render_attributes($attributes));
     $output .= isset($field['placeholder']) ? "<option value=''>{$field['placeholder']}</option>" : '<option></option>';
     $output .= $walker->walk($children, -1);
     $output .= '</select>';
     foreach ($children as $c) {
         if (isset($options[$c->{$id}])) {
             $output .= $this->display_level($options, $c->{$id}, in_array($c->{$id}, $this->meta) && $active);
         }
     }
     $output .= '</div>';
     return $output;
 }