/** * Get field HTML * * @param $field * @param $meta * * @return string */ static function html($meta, $field) { $options = $field->options; $terms = get_terms($options['taxonomy'], $options['args']); $field->options = self::get_options($terms); $field->display_type = $options['type']; $html = ''; switch ($options['type']) { case 'checkbox_list': $html = Field_Checkbox_List::html($meta, $field); break; case 'checkbox_tree': $elements = self::process_terms($terms); $html .= self::walk_checkbox_tree($meta, $field, $elements, $options['parent'], true); break; case 'select_tree': $elements = self::process_terms($terms); $html .= self::walk_select_tree($meta, $field, $elements, $options['parent'], true); break; case 'select_advanced': $html = Field_Select_Advanced::html($meta, $field); break; case 'select': default: $html = Field_Select::html($meta, $field); } return $html; }
/** * Get meta value * If field is cloneable, value is saved as a single entry in DB * Otherwise value is saved as multiple entries (for backward compatibility) * * @see "save" method for better understanding * * @param $post_id * @param $saved * @param $field * * @return array */ public function meta($post_id, $saved, $field) { if (isset($field['parent']) && $field['parent']) { $post = get_post($post_id); return $post->post_parent; } return parent::meta($post_id, $saved, $field); }