Fieldmanager_Field::add_term_form PHP Method

add_term_form() public method

Add a form on a term add/edit page
See also: Fieldmanager_Context_Term
Deprecation: 1.0.0-beta.3 Replaced by {@see \Fieldmanager_Field::add_term_meta_box()}.
public add_term_form ( string $title, string | array $taxonomies, boolean $show_on_add = true, boolean $show_on_edit = true, integer $parent = '' )
$title string
$taxonomies string | array The taxonomies on which to display this form
$show_on_add boolean Whether or not to show the fields on the add term form
$show_on_edit boolean Whether or not to show the fields on the edit term form
$parent integer Only show this field on child terms of this parent term ID
    public function add_term_form($title, $taxonomies, $show_on_add = true, $show_on_edit = true, $parent = '')
    {
        $this->require_base();
        return new Fieldmanager_Context_Term(array('title' => $title, 'taxonomies' => $taxonomies, 'show_on_add' => $show_on_add, 'show_on_edit' => $show_on_edit, 'parent' => $parent, 'use_fm_meta' => true, 'field' => $this));
    }

Usage Example

 /**
  * Set up the request environment values and save the data.
  *
  * @param Fieldmanager_Field $field
  * @param WP_Post $post
  * @param mixed $values
  */
 public function save_values($field, $term, $values)
 {
     $field->add_term_form($field->name, $term->taxonomy)->save_to_term_meta($term->term_id, $term->taxonomy, $values);
 }