Fieldmanager_Context
abstract class Fieldmanager_Context (View source)
Base class for contexts.
Contexts dictate where fields appear, how they load data, and where they save data.
Properties
Fieldmanager_Field | $fm | The base field associated with this context. |
|
string | $uniqid | Unique ID of the form. Used for forms that are not built into WordPress. |
|
array | $save_keys | Store the meta keys this field saves to, to catch naming conflicts. |
Methods
Instantiate this context.
Get the nonce key for this field.
Include a fresh nonce for this field in a response with refreshed nonces.
Check if the nonce is valid. Returns false if the nonce is missing and throws an exception if it's invalid. If all goes well, returns true.
Prepare the data for saving.
Render the field.
Details
__construct()
Instantiate this context.
protected string
nonce_key()
Get the nonce key for this field.
array
refresh_nonce(array $response)
Include a fresh nonce for this field in a response with refreshed nonces.
protected bool
is_valid_nonce()
Check if the nonce is valid. Returns false if the nonce is missing and throws an exception if it's invalid. If all goes well, returns true.
protected mixed
prepare_data(mixed $old_value = null, mixed $new_value = null, object $fm = null)
Prepare the data for saving.
protected string
render_field(array $args = array())
Render the field.