/** * Generates HTML for the term field * @access public * @param string $html_template THe HTML used to wrap the field * @param string $taxonomy * @param WP_Term $term * @return string The element markup */ public function term_fields($html_template, $taxonomy, $term = null) { // Make sure the user hasn't specified a field name we can't use if (in_array($this->fm->name, $this->reserved_fields)) { $this->fm->_invalid_definition(sprintf(__('The field name "%s" is reserved for WordPress on the term form.', 'fieldmanager'), $this->fm->name)); } // Set the data type and ID $this->fm->data_type = 'term'; $this->fm->data_id = is_object($term) ? $term->term_id : null; $this->current_taxonomy = $taxonomy; // Create the display label if one is set if (!empty($this->title)) { $label = sprintf('<label for="%s">%s</label>', esc_attr($this->fm->name), esc_html($this->title)); } else { $label = ''; } $field = $this->render_field(array('echo' => false)); // Create the markup and return it return sprintf($html_template, $label, $field); }