Skip to main content

InputPairs

Store mutliple key-value string pairs.

Value

Returns { title: string, value: string }[]

$pairs = json_decode(fx_get_meta('id'), true);
foreach($pairs as $pair) {
$title = $pair['title'];
$value = $pair['value'];
}

Example

'id' => [
'type' => 'input-pairs',
'buttonText' => 'Add',
'className' => 'my-class-name',
'limit' => 4,
'listView' => true,
'titleLabel' => 'Title',
'valueInput' => 'textfield',
'valueLabel' => 'Value',
],

Props

buttonText

Alternate text for the add button

type: string

defaultValue: 'Add'

className

Metabox class name

type: string

limit

Limit the number of inputs allowed

type: number

listView

Show the inputs in a list view

type: bool

title

Metabox title

type: string

titleLabel

Label for the title input

type: string

defaultValue: 'Title'

valueInput

Input type for the value input (has limited support).

type: enum('textarea'|'textfield')

defaultValue: 'textarea'

valueLabel

Label for the value input

type: string

defaultValue: 'Description'