Skip to content

TaxonomyRelationshipControl

Junaid Bhura edited this page Feb 1, 2019 · 1 revision

taxonomy-relationship-control

This component is used to select related taxonomies in a block. It inherits BaseControl.

Usage

import { TaxonomyRelationshipControl } = gumponents.components;

<TaxonomyRelationshipControl
	label="Select people roles"
	taxonomies="people_roles"
	value={ taxonomy.map( tax => tax.term_id ) }
	onSelect={ taxonomy => setAttributes( { taxonomy } ) }
	buttonLabel="Select People Roles"
	filter="people_meta"
	max="1"
/>

Props

label

The label for the control.

  • Type: String
  • Required: No

help

The help text for the control.

  • Type: String
  • Required: No

taxonomies

Taxonomies to query for.

  • Type: String | Array
  • Required: No

buttonLabel

The label for the select button.

  • Type: String
  • Required: No

value

The selected taxonomy IDs for this control.

  • Type: Array
  • Required: Yes

onSelect

A function that receives the values of the control.

  • Type: Function
  • Required: Yes

filter

Creates a custom filter name which can be used to further customize results. More below.

  • Type: String
  • Required: No

max

The maximum number of selections that can be made with this control.

  • Type: Number
  • Required: No

Filters

gumponents_taxonomies_relationship_query

This filter is used to query the get_terms args before they are executed for this control.

If the filter property is used, then that gets appended to this, to create a custom filter name. For example if the value of the filter property was people_meta, the available filter would be gumponents_taxonomies_relationship_query_people_meta

gumponents_taxonomies_relationship_results

This filter is used to customize results before they are passed on to this control.

If the filter property is used, then that gets appended to this, to create a custom filter name. For example if the value of the filter property was people_meta, the available filter would be gumponents_taxonomies_relationship_results_people_meta

Clone this wiki locally