/** * Get field HTML * * @param mixed $meta * @param array $field * * @return string */ static function html($meta, $field) { $field['options'] = self::get_options($field); switch ($field['field_type']) { case 'select': return WCQD_METABOX_Select_Field::html($meta, $field); case 'select_advanced': default: return WCQD_METABOX_Select_Advanced_Field::html($meta, $field); } }
/** * Walker for displaying select in tree format * * @param $meta * @param $field * @param $elements * @param int $parent * @param bool $active * * @return string */ static function walk_select_tree($meta, $field, $elements, $parent = 0, $active = false) { if (!isset($elements[$parent])) { return ''; } $terms = $elements[$parent]; $field['options'] = self::get_options($terms); $classes = array('rw-taxonomy-tree'); $classes[] = $active ? 'active' : 'disabled'; $classes[] = "rwmb-taxonomy-{$parent}"; $html = '<div class="' . implode(' ', $classes) . '">'; $html .= WCQD_METABOX_Select_Field::html($meta, $field); foreach ($terms as $term) { $html .= self::walk_select_tree($meta, $field, $elements, $term->term_id, $active && in_array($term->term_id, $meta)); } $html .= '</div>'; return $html; }