Fieldmanager
  • Package
  • Class
  • Tree
  • Todo

Packages

  • Fieldmanager
    • Context
    • Datasource
    • Field
    • Util
  • None

Classes

  • Fieldmanager_Context
  • Fieldmanager_Context_Page
  • Fieldmanager_Context_Post
  • Fieldmanager_Context_QuickEdit
  • Fieldmanager_Context_Storable
  • Fieldmanager_Context_Submenu
  • Fieldmanager_Context_Term
  • Fieldmanager_Context_User

Class Fieldmanager_Context_Term

Use fieldmanager to create meta boxes on the new/edit term screens and save data primarily to term meta.

Fieldmanager_Context
Extended by Fieldmanager_Context_Storable
Extended by Fieldmanager_Context_Term
Package: Fieldmanager\Context
Located at context/class-fieldmanager-context-term.php

Methods summary

public
# __construct( array|string $args, string|array $taxonomies = array(), boolean $show_on_add = true, boolean $show_on_edit = true, string $parent = '', Fieldmanager_Field $fm = null )

Instantiate this context. You can either pass an array of all args (preferred), or pass them individually (deprecated).

Instantiate this context. You can either pass an array of all args (preferred), or pass them individually (deprecated).

Parameters

$args
array|string
$args { Array of arguments. If a string (deprecated), this will be used as the $title.
$taxonomies
string|array
$taxonomies Optional. Deprecated. Required if $args is a string.
$show_on_add
boolean
$show_on_add Optional. Deprecated.
$show_on_edit
boolean
$show_on_edit Optional. Deprecated.
$parent
string
$parent Optional. Deprecated.
$fm
Fieldmanager_Field
$fm Optional. Deprecated.

Type

string $title The context/meta box title.
string|array $taxonomies The taxonomy/taxonomies to which to add this field.
bool $show_on_add Optional. Should this field show on the "Add Term" screen? Defaults to yes (true).
bool $show_on_edit Optional. Should this field show on the "Edit Term" screen? Defaults to yes (true).
int $parent Optional. Should this field only show if its parent matches this term ID?
bool $use_fm_meta Optional. Should this context store its data using FM term meta (true, deprecated) or WordPress core term meta (false). Defaults to false.
Fieldmanager_Field $field Optional. The field to which to attach this context. }
public
# add_term_fields( string $taxonomy )

Creates the HTML template for wrapping fields on the add term form and prints the field

Creates the HTML template for wrapping fields on the add term form and prints the field

Parameters

$taxonomy
string
$taxonomy
public
# edit_term_fields( WP_Term $term, string $taxonomy )

Creates the HTML template for wrapping fields on the edit term form and prints the field

Creates the HTML template for wrapping fields on the edit term form and prints the field

Parameters

$term
WP_Term
$tag
$taxonomy
string
$taxonomy
public string
# term_fields( string $html_template, string $taxonomy, WP_Term $term = null )

Generates HTML for the term field

Generates HTML for the term field

Parameters

$html_template
string
$html_template THe HTML used to wrap the field
$taxonomy
string
$taxonomy
$term
WP_Term
$term

Returns

string
The element markup
public
# save_term_fields( integer $term_id, integer $tt_id, string $taxonomy )

Saves custom term fields

Saves custom term fields

Parameters

$term_id
integer
$term_id
$tt_id
integer
$tt_id
$taxonomy
string
$taxonomy
public
# save_to_term_meta( integer $term_id, array $taxonomy, mixed $data = null )

Helper to save an array of data to term meta

Helper to save an array of data to term meta

Parameters

$term_id
integer
$term_id
$taxonomy
array
$data
$data

Magic methods summary

Properties summary

public string $title
#

Title of field to display in standard term form field location

Title of field to display in standard term form field location

public string[] $taxonomies
#

What taxonomies to render these fields

What taxonomies to render these fields

public boolean $show_on_add
#

Whether or not to show the fields on the term add form

Whether or not to show the fields on the term add form

public boolean $show_on_edit
#

Whether or not to show the fields on the term edit form

Whether or not to show the fields on the term edit form

public integer $parent
#

Only show this field on child terms of this parent

Only show this field on child terms of this parent

public array $reserved_fields
#

Field names reserved for WordPress on the term add/edit forms

Field names reserved for WordPress on the term add/edit forms

public boolean $use_fm_meta
#

Use FM term meta or WordPres core term meta. The default is a bit confusing: technically, it's to use core's term meta, but if the class is instantiated using the now-deprecated separated arguments, this gets set to true for backwards-compatibility purposes.

Use FM term meta or WordPres core term meta. The default is a bit confusing: technically, it's to use core's term meta, but if the class is instantiated using the now-deprecated separated arguments, this gets set to true for backwards-compatibility purposes.

This should be false whenever possible to instead use core's built-in term meta (introduced in WordPress 4.4).

public Fieldmanager_Field $fm
#

Base field

Base field

Properties inherited from Fieldmanager_Context_Storable

$taxonomies_to_save

Properties inherited from Fieldmanager_Context

$save_keys, $uniqid

Fieldmanager API documentation generated by ApiGen 2.8.0