Simple Fields API Documentation
Class

simple_fields_field_example

class simple_fields_field_example extends simple_fields_field

Properties

$key
$name
$description
$field_url

Methods

__construct()

string options_output($existing_vals)

Output on options screen

options_save()

from simple_fields_field
string edit_output($saved_values, $options)

Output fields and stuff on post edit page This is the output a regular user will see

mixed, edit_save(array $values = NULL)

Called when saving fields, i.e.

from simple_fields_field
set_options_base_id(string $string)

Sets the base for the generation of input ids in options screen Called by options screen.

from simple_fields_field
set_options_base_name($string)

Sets the base for the generation of input names in options screen Called by options screen.

from simple_fields_field
string get_options_id($name $name)

Get the id to use in input or label or similiar to be used in options screen

from simple_fields_field
string get_options_name($name $name)

Get the name to use in input or label or similiar to be used in options screen

from simple_fields_field
get_class_name(string $class)

Return a classname prefixed with simple fields and our field type, to be used in edit post screen Use this to generate class names to make sure they don't collide with other class names in WordPress (from other plugins for example)

from simple_fields_field
return_values($values)

Possibly modify values before returning them Used from functions simplefieldsvalue and simplefieldsvalues $values is an array beginning at 0, for each field, so loop to change all your values (there are several if using repeatable)

Details

at line 44
public __construct()

at line 52
public string options_output($existing_vals)

Output on options screen

Parameters

$existing_vals

Return Value

string

in simple_fields_field at line 34
public options_save()

at line 124
public string edit_output($saved_values, $options)

Output fields and stuff on post edit page This is the output a regular user will see

Parameters

$saved_values
$options

Return Value

string

in simple_fields_field at line 62
public mixed, edit_save(array $values = NULL)

Called when saving fields, i.e.

when clicking the Publish-button on a edit post screen Was is returned from this method will be what is saved in the database, so this is the place to change from array (the default) to for example a single string value that is good for sorting.

Override this in the fields class to modify the value being saved.

Parameters

array $values The values that we receive from the post screen. It's the same names as the ones that has been added with $this->getoptionsname()

Return Value

mixed, array or string of values to save in db

in simple_fields_field at line 71
public set_options_base_id(string $string)

Sets the base for the generation of input ids in options screen Called by options screen.

Parameters

string $string

in simple_fields_field at line 80
public set_options_base_name($string)

Sets the base for the generation of input names in options screen Called by options screen.

Parameters

$string

in simple_fields_field at line 89
public string get_options_id($name $name)

Get the id to use in input or label or similiar to be used in options screen

Parameters

$name $name a-z

Return Value

string

in simple_fields_field at line 98
public string get_options_name($name $name)

Get the name to use in input or label or similiar to be used in options screen

Parameters

$name $name a-z

Return Value

string

in simple_fields_field at line 107
public get_class_name(string $class)

Return a classname prefixed with simple fields and our field type, to be used in edit post screen Use this to generate class names to make sure they don't collide with other class names in WordPress (from other plugins for example)

Parameters

string $class Name of class to append

at line 150
public return_values($values)

Possibly modify values before returning them Used from functions simplefieldsvalue and simplefieldsvalues $values is an array beginning at 0, for each field, so loop to change all your values (there are several if using repeatable)

Parameters

$values