Post_Type
in package
Post type base class
Represents a post type that:
- can be saved and retrieved
- has fields that are validated with magic accessor methods
- has metaboxes
- declares a non-herarchical (tag) custom taxonomy
Tags
Table of Contents
- $object_cache : mixed
- $post_id : int
- The id of the post that this object represents.
- __get() : mixed
- Allows getting one of this object's fields.
- __set() : mixed
- Allows setting a field for this object, after a few checks.
- __toString() : string
- To String.
- delete() : mixed
- Trashes this object in the DB.
- load() : mixed
- Load a Wallet, Currency, Transaction or Address from its custom post entry.
- load_many() : array<string|int, Post_Type>
- Loads Wallets, Currencies, Transactions and Addresses by their post_ids. Quickly.
- save() : void
- Saves this object to the DB.
- render_bool_field() : mixed
- render_boolean_field() : mixed
- render_number_field() : mixed
- render_secret_field() : mixed
- render_select_field() : mixed
- render_string_field() : mixed
- render_strings_field() : mixed
Properties
$object_cache
protected
static mixed
$object_cache
= []
$post_id
The id of the post that this object represents.
protected
int
$post_id
Methods
__get()
Allows getting one of this object's fields.
public
abstract __get(string $name) : mixed
Parameters
- $name : string
-
The name of the field to retrieve.
Return values
mixed —__set()
Allows setting a field for this object, after a few checks.
public
__set(string $name, mixed $value) : mixed
Subclasses that override this method must delegate to this parent once they do their thing.
Parameters
- $name : string
-
The name of the field. Can be 'post_id', etc.
- $value : mixed
-
The value to set to the field.
Tags
Return values
mixed —__toString()
To String.
public
abstract __toString() : string
Converts this object into a form that can be written out to logs for debugging.
Return values
string —delete()
Trashes this object in the DB.
public
delete([mixed $force = false ]) : mixed
Parameters
- $force : mixed = false
Tags
Return values
mixed —load()
Load a Wallet, Currency, Transaction or Address from its custom post entry.
public
abstract static load(int $post_id) : mixed
Parameters
- $post_id : int
-
The post_id for the object to load.
Tags
Return values
mixed —The Wallet, Currency, Transaction or Address loaded.
load_many()
Loads Wallets, Currencies, Transactions and Addresses by their post_ids. Quickly.
public
static load_many(array<string|int, mixed> $post_ids[, string|null $post_type = null ]) : array<string|int, Post_Type>
Any IDs not found are skipped silently.
Parameters
- $post_ids : array<string|int, mixed>
-
The post IDs corresponding to the objects to load.
- $post_type : string|null = null
-
Optionally retrieve only posts of this type.
Tags
Return values
array<string|int, Post_Type> —The instantiated objects.
save()
Saves this object to the DB.
public
abstract save() : void
If the object already had a post_id, then the post is updated. Else, a new custom post is created and the new post_id is assigned to the object.
Return values
void —render_bool_field()
protected
static render_bool_field(mixed $schema, mixed $value) : mixed
Parameters
- $schema : mixed
- $value : mixed
Return values
mixed —render_boolean_field()
protected
static render_boolean_field(mixed $schema, mixed $value) : mixed
Parameters
- $schema : mixed
- $value : mixed
Return values
mixed —render_number_field()
protected
static render_number_field(mixed $schema, mixed $value) : mixed
Parameters
- $schema : mixed
- $value : mixed
Return values
mixed —render_secret_field()
protected
static render_secret_field(mixed $schema, mixed $value) : mixed
Parameters
- $schema : mixed
- $value : mixed
Return values
mixed —render_select_field()
protected
static render_select_field(mixed $schema, mixed $value) : mixed
Parameters
- $schema : mixed
- $value : mixed
Return values
mixed —render_string_field()
protected
static render_string_field(mixed $schema, mixed $value) : mixed
Parameters
- $schema : mixed
- $value : mixed
Return values
mixed —render_strings_field()
protected
static render_strings_field(mixed $schema, mixed $value) : mixed
Parameters
- $schema : mixed
- $value : mixed