diff --git a/docs/class-reference-collections.md b/docs/class-reference-collections.md deleted file mode 100644 index 6115b8391..000000000 --- a/docs/class-reference-collections.md +++ /dev/null @@ -1,70 +0,0 @@ -# Collections - -## Collection Repository - - -### `protected function __construct()` - -Collections constructor. - - -### `public function get_map()` - -{@inheritDoc} -### `public function get_cpt_labels()` - -Get the labels for the custom post type of this repository - - -**Returns:** `array` — Labels in the format expected by register_post_type() - -### `public function insert( $collection )` - -{@inheritDoc} -**Parameters:** - -* `$collection` — \Tainacan\Entities\Collection - -**Returns:** \Tainacan\Entities\Collection - -### `public function delete( $args )` - - -**Parameters:** - -* `(` — $args — is a array like [post_id, [is_permanently => bool]] ) - -**Returns:** mixed|Collection - -### `public function fetch( $args = [], $output = null )` - -fetch collection based on ID or WP_Query args - -Collections are stored as posts. Check WP_Query docs to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/) You can also use a mapped property, such as name and description, as an argument and it will be mapped to the appropriate WP_Query argument - - -**Parameters:** - -* `$args` — array — WP_Query args || int $args the collection id -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `\WP_Query|Array` — an instance of wp query OR array of entities; - -### `public function map_meta_cap( $caps, $cap, $user_id, $args )` - -Filter to handle special permissions - - - - -## Collection Entity - - -### `function validate()` - -Validate Collection - - -**Returns:** bool - - \ No newline at end of file diff --git a/docs/class-reference-fields.md b/docs/class-reference-fields.md deleted file mode 100644 index 45beea315..000000000 --- a/docs/class-reference-fields.md +++ /dev/null @@ -1,516 +0,0 @@ -# Metadata - -## Metadatum Repository - - -### `class Metadata extends Repository` - -Class Metadata - - -### `protected function __construct()` - -Register specific hooks for metadatum repository - - -### `public function get_cpt_labels()` - -Get the labels for the custom post type of this repository -**Returns:** `array` — Labels in the format expected by register_post_type() - -### `public function get_default_metadata_attribute()` - -constant used in default metadatum in attribute collection_id - - -**Returns:** `string` — the value of constant - -### `public function register_field_type( $class_name )` - -register metadatum types class on array of types - - -**Parameters:** - -* `string` — $class_name — | object The class name or the instance - -### `public function unregister_field_type( $class_name )` - -register metadatum types class on array of types - - -**Parameters:** - -* `string` — $class_name — | object The class name or the instance - -### `public function fetch( $args, $output = null )` - -fetch metadatum based on ID or WP_Query args - -metadatum are stored as posts. Check WP_Query docs to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/) You can also use a mapped property, such as name and description, as an argument and it will be mapped to the appropriate WP_Query argument - - -**Parameters:** - -* `$args` — array — WP_Query args || int $args the metadatum id -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `Entities\Metadatum|\WP_Query|Array` — an instance of wp query OR array of entities; - -### `public function fetch_by_collection(Entities\Collection $collection, $args = [], $output = null)` - -fetch metadatum by collection, searches all metadatum available - - -**Parameters:** - -* `$collection` — Entities\Collection -* `$args` — array — WP_Query args plus disabled_fields -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `array` — Entities\Metadatum - -### `public function order_result( $result, Entities\Collection $collection, $include_disabled = false )` - -Ordinate the result from fetch response if $collection has an ordination, metadata not ordinated appear on the end of the list - - - - -**Parameters:** - -* `Response` — $result — from method fetch -* `$collection` — Entities\Collection -* `$include_disabled` — bool — Wether to include disabled metadata in the results or not - -**Returns:** `array` — or WP_Query ordinate - -### `public function insert($metadatum)` - -{@inheritDoc} -**Parameters:** - -* `$metadatum` — \Tainacan\Entities\Metadatum - -**Returns:** \Tainacan\Entities\Metadatum - -### `public function update($object, $new_values = null)` - - -**Returns:** mixed|string|Entities\Entity - -### `public function fetch_field_types( $output = 'CLASS')` - -fetch all registered metadatum type classes - -Possible outputs are: CLASS (default) - returns the Class name of of metadatum types registered NAME - return an Array of the names of metadatum types registered - - -**Parameters:** - -* `string` — $output — CLASS | NAME - -**Returns:** `array` — of Entities\Metadatum_Types\Metadatum_Type classes path name - -### `public function register_core_fields( Entities\Collection $collection )` - - -**Parameters:** - -* `$collection` — Entities\Collection - -**Returns:** bool - -### `public function disable_delete_core_fields( $before, $post )` - -block user from remove core metadata - - -**Parameters:** - -* `wordpress` — $before — pass a null value -* `the` — $post — post which is moving to trash - -**Returns:** null/bool - -### `public function force_delete_core_fields( $before, $post, $force_delete )` - -block user from remove core metadata ( if use wp_delete_post) - - -**Parameters:** - -* `wordpress` — $before — pass a null value -* `the` — $post — post which is deleting -* `a` — $force_delete — boolean that force the deleting - -**Returns:** `null` — /bool - -### `public function get_core_fields( Entities\Collection $collection )` - -returns all core items from a specific collection - - -**Parameters:** - -* `$collection` — Entities\Collection - -**Returns:** Array|\WP_Query - -### `public function insert_array_field( $data )` - -create a metadatum entity and insert by an associative array ( attribute => value ) - - -**Parameters:** - -* `$data` — Array — the array of attributes to insert a metadatum - -**Returns:** `int` — the metadatum id inserted - -### `public function fetch_all_field_values($collection_id, $metadatum_id)` - -Fetch all values of a metadatum from a collection in all it collection items - - -**Returns:** array|null|object - -### `private function pre_update_taxonomy_field($metadatum)` - -Stores the value of the taxonomy_id option to use on update_taxonomy_field method. - - - - -### `private function update_taxonomy_field($metadatum)` - -Triggers hooks when saving a Taxonomy Metadatum, indicating wich taxonomy was added or removed from a collection. - -This is used by Taxonomies repository to update the collections_ids property of the taxonomy as a metadatum type taxonomy is inserted or removed - - -**Parameters:** - -* `$metadatum` — [type] — [description] - -**Returns:** `[type]` — [description] - - - -## Metadatum Entity - - -### `class Metadatum extends Entity` - -Represents the Entity Metadatum - - -### `protected $repository = 'Metadata'` - -{@inheritDoc} -### `function get_name()` - -Return the metadatum name - - -**Returns:** string - -### `function get_slug()` - -Get metadatum slug - - -**Returns:** string - -### `function get_order()` - -Return the metadatum order type - - -**Returns:** string - -### `function get_parent()` - -Return the parent ID - - -**Returns:** string - -### `function get_description()` - -Return the metadatum description - - -**Returns:** string - -### `function get_required()` - -Return if is a required metadatum - - -**Returns:** boolean - -### `function get_multiple()` - -Return if is a multiple metadatum - - -**Returns:** boolean - -### `function get_cardinality()` - -Return the cardinality - - -**Returns:** string - -### `function get_collection_key()` - -Return if metadatum is key - - -**Returns:** boolean - -### `function get_mask()` - -Return the mask - - -**Returns:** string - -### `function get_default_value()` - -Return the metadatum default value - - -**Returns:** `string` — || integer - -### `function get_field_type_object()` - -Return the an object child of \Tainacan\Metadatum_Types\Metadatum_Type with options - - -**Returns:** `\Tainacan\Metadatum_Types\Metadatum_Type` — The metadatum type class with filled options - -### `function get_field_type()` - -Return the class name for the metadatum type - - -**Returns:** `string` — The - -### `function get_field_type_options()` - -Return the actual options for the current metadatum type - - -**Returns:** `array` — Configurations for the metadatum type object - -### `function set_name($value)` - -Set the metadatum name - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function get_accept_suggestion()` - -Return true if this metadatum allow community suggestions, false otherwise -**Returns:** bool - -### `function set_slug($value)` - -Set the metadatum slug - -If you dont set the metadatum slug, it will be set automatically based on the name and following WordPress default behavior of creating slugs for posts. - -If you set the slug for an existing one, WordPress will append a number at the end of in order to make it unique (e.g slug-1, slug-2) - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_order($value)` - -Set manually the order of the metadatum - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_parent($value)` - -Set the metadatum parent ID - - -**Parameters:** - -* `$value` — [integer] — The ID from parent - -**Returns:** void - -### `function set_description($value)` - -Set metadatum description - - -**Parameters:** - -* `$value` — [string] — The text description - -**Returns:** void - -### `function set_required( $value )` - -Allow the metadatum be required - - -**Parameters:** - -* `$value` — [boolean] - -**Returns:** void - -### `function set_multiple( $value )` - -Allow multiple metadata - - -**Parameters:** - -* `$value` — [boolean] - -**Returns:** void - -### `function set_cardinality( $value )` - -The number of possible metadata - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_collection_key( $value )` - -Define if the value is key on the collection - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_mask( $value )` - -Set mask for the metadatum - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_privacy( $value )` - -Set privacy - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_default_value( $value )` - -Set default value - - -**Parameters:** - -* `||` — [string — integer] $value - -**Returns:** void - -### `public function set_field_type( $value )` - -set the metadatum type class name - - -**Parameters:** - -* `|` — string — \Tainacan\Metadatum_Types\Metadatum_Type $value The name of the class or the instance - -### `function set_accept_suggestion( $value )` - -Set if this metadatum allow community suggestions -**Parameters:** - -* `$value` — bool - -### `function set_field_type_options( $value )` - -Set Metadatum type options - - -**Parameters:** - -* `||` — [string — integer] $value - -**Returns:** void - -### `public function get_enabled_for_collection()` - -Transient property used to store the status of the metadatum for a particular collection - -Used by the API to tell front end when a metadatum is disabled - - - - -### `function is_multiple()` - -Return true if is multiple, else return false - - -**Returns:** boolean - -### `function is_collection_key()` - -Return true if is collection key, else return false - - -**Returns:** boolean - -### `function is_required()` - -Return true if is required, else return false - - -**Returns:** boolean - -### `public function validate()` - -{@inheritdoc } - -Also validates the metadatum, calling the validate_options callback of the Metadatum Type - - -**Returns:** `bool` — valid or not - - \ No newline at end of file diff --git a/docs/class-reference-filters.md b/docs/class-reference-filters.md deleted file mode 100644 index c87124b07..000000000 --- a/docs/class-reference-filters.md +++ /dev/null @@ -1,239 +0,0 @@ -# Filters - -## Filter Repository - - -### `public function delete($args)` - - -**Parameters:** - -* `$args` — array - -**Returns:** Entities\Filter - -### `public function fetch($args = [], $output = null)` - -fetch filter based on ID or WP_Query args - -Filters are stored as posts. Check WP_Query docs to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/) You can also use a mapped property, such as name and description, as an argument and it will be mapped to the appropriate WP_Query argument - - -**Parameters:** - -* `$args` — array — WP_Query args || int $args the filter id -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `\WP_Query|Array` — an instance of wp query OR array of entities; - -### `public function register_filter_type( $class_name )` - -register metadatum types class on array of types - - -**Parameters:** - -* `string` — $class_name — | object The class name or the instance - -### `public function deregister_filter_type( $class_name )` - -register metadatum types class on array of types - - -**Parameters:** - -* `string` — $class_name — | object The class name or the instance - -### `public function fetch_filter_types( $output = 'CLASS')` - -fetch all registered filter type classes - -Possible outputs are: CLASS (default) - returns the Class name of of filter types registered NAME - return an Array of the names of filter types registered - - -**Parameters:** - -* `string` — $output — CLASS | NAME - -**Returns:** `array` — of Entities\Filter_Types\Filter_Type classes path name - -### `public function fetch_supported_filter_types($types)` - -fetch only supported filters for the type specified - - -**Parameters:** - -* `string` — ( — || array ) $types Primitve types of metadatum ( float, string, int) - -**Returns:** `array` — Filters supported by the primitive types passed in $types - -### `public function fetch_by_collection(Entities\Collection $collection, $args = [], $output = null)` - -fetch filters by collection, searches all filters available - - -**Parameters:** - -* `$collection` — Entities\Collection -* `$args` — array — WP_Query args plus disabled_fields -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `Array` — Entities\Metadatum - -### `public function order_result( $result, Entities\Collection $collection )` - -Ordinate the result from fetch response if $collection has an ordination, filters not ordinated appear on the end of the list - - - - -**Parameters:** - -* `Response` — $result — from method fetch -* `$collection` — Entities\Collection - -**Returns:** `array` — or WP_Query ordinate - - - -## Filter Entity - - -### `class Filter extends Entity` - -Represents the entity Filter - - -### `protected $repository = 'Filters'` - -{@inheritDoc} -### `public function _toArray()` - - -**Returns:** array - -### `function get_name()` - -Return the filter name - - -**Returns:** string - -### `function get_description()` - - -**Returns:** mixed|null - -### `function get_order()` - -Return the filter order type - - -**Returns:** string - -### `function get_color()` - -Return the filter color - - -**Returns:** string - -### `function get_field()` - -Return the metadatum - - -**Returns:** Metadatum - -### `function get_filter_type_object()` - -Return the an object child of \Tainacan\Filter_Types\Filter_Type with options - - -**Returns:** `\Tainacan\Filter_Types\Filter_Type` — The filter type class with filled options - -### `function get_filter_type()` - -Return the class name for the filter type - - -**Returns:** `string` — The - -### `function get_filter_options()` - -Return the actual options for the current filter type - - -**Returns:** `array` — Configurations for the filter type object - -### `function set_name($value)` - -Define the filter name - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_order($value)` - -Define the filter order type - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_description($value)` - -Define the filter description - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_color( $value )` - -Define the filter color - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_field( $value )` - -Define the filter metadatum - - -**Returns:** void - -### `public function set_filter_type($value)` - -Save the filter type class name - - -**Parameters:** - -* `|` — string — \Tainacan\Filter_Types\Filter_Type $value The name of the class or the instance - -### `public function validate()` - -{@inheritdoc } - -Also validates the metadatum, calling the validate_options callback of the Metadatum Type - - -**Returns:** `bool` — valid or not - - \ No newline at end of file diff --git a/docs/class-reference-item-metadata.md b/docs/class-reference-item-metadata.md deleted file mode 100644 index 0693bbfa6..000000000 --- a/docs/class-reference-item-metadata.md +++ /dev/null @@ -1,216 +0,0 @@ -# Item Metadata - -## Item Metadata Repository - - -### `if ( $item_metadata->get_field()->get_parent() > 0 && is_null($item_metadata->get_meta_id()) )` - -When we are adding a metadatum that is child of another, this means it is inside a compound metadatum - -In that case, if the Item_Metadata object is not set with a meta_id, it means we want to create a new one and not update an existing. This is the case of a multiple compound metadatum. - - -### `public function delete($item_metadata)` - - -**Returns:** mixed|void - -### `public function add_compound_value(Entities\Item_Metadata_Entity $item_metadata, $meta_id)` - - - - -**Returns:** `null|ind` — the meta id of the created compound metadata - -### `public function fetch($object, $output = null )` - -Fetch Item Metadatum objects related to an Item - - -**Parameters:** - -* `$object` — Entities\Item - -**Returns:** array - -### `public function get_value(Entities\Item_Metadata_Entity $item_metadata)` - -Get the value for a Item metadatum. - - -**Parameters:** - -* `$item_metadata` — Entities\Item_Metadata_Entity - -**Returns:** mixed - -### `private function extract_compound_value(array $ids, Entities\Item $item, $compund_meta_id)` - -Transforms the array saved as meta_value with the IDs of post_meta saved as a value for compound metadata and converts it into an array of Item Metadatada Entitites - - -**Parameters:** - -* `$ids` — array — The array of post_meta ids -* `$item` — Entities\Item — The item this post_meta is related to -* `$compund_meta_id` — int — the meta_id of the parent compound metadata - -**Returns:** `array` — An array of Item_Metadata_Entity objects - -### `public function update( $object, $new_values = null )` - - -**Returns:** mixed - -### `public function suggest($item_metadata)` - -Suggest a value to be inserted as a item Metadatum value, return a pending log -**Parameters:** - -* `$item_metadata` — Entities\Item_Metadata_Entity - -**Returns:** Entities\Log - - - -## Item Metadata Entity - - -### `class Item_Metadata_Entity extends Entity` - -Represents the Item Metadatum Entity - - -### `protected $repository = 'Item_Metadata'` - -{@inheritDoc} -### `function __construct(Item $item, Metadatum $metadatum, $meta_id = null, $parent_meta_id = null)` - - - - -**Parameters:** - -* `$item` — Item — Item Entity -* `$metadatum` — Metadatum — Metadatum Entity -* `$meta_id` — int — ID for a specific meta row - -### `function set_item(Item $item)` - -Define the item - - -**Parameters:** - -* `$item` — Item - -**Returns:** void - -### `function set_value($value)` - -Define the metadatum value - - -**Parameters:** - -* `|` — [integer — string] $value - -**Returns:** void - -### `function set_field(Metadatum $metadatum)` - -Define the metadatum - - -**Parameters:** - -* `$metadatum` — Metadatum - -**Returns:** void - -### `function set_meta_id($meta_id)` - -Set the specific meta ID for this metadata. - -When this value is set, get_value() will use it to fetch the value from the post_meta table, instead of considering the item and metadatum IDs - - -**Parameters:** - -* `$meta_id` — int — the ID of a specifica post_meta row - -### `function set_parent_meta_id($parent_meta_id)` - -Set parent_meta_id. Used when a item_metadata is inside a compound Metadatum - -When you have a multiple compound metadatum, this indicates of which instace of the value this item_metadata is attached to - - -**Parameters:** - -* `$parent_meta_id` — [type] — [description] - -### `function get_item()` - -Return the item - - -**Returns:** Item - -### `function get_field()` - -Return the metadatum - - -**Returns:** Metadatum - -### `function get_meta_id()` - -Return the meta_id - - -**Returns:** Metadatum - -### `function get_parent_meta_id()` - -Return the meta_id - - -**Returns:** Metadatum - -### `function get_value()` - -Return the metadatum value - - -**Returns:** `string` — | integer - -### `function is_multiple()` - -Return true if metadatum is multiple, else return false - - -**Returns:** boolean - -### `function is_collection_key()` - -Return true if metadatum is key - - -**Returns:** boolean - -### `function is_required()` - -Return true if metadatum is required - - -**Returns:** boolean - -### `function validate()` - -Validate attributes - - -**Returns:** boolean - - \ No newline at end of file diff --git a/docs/class-reference-items.md b/docs/class-reference-items.md deleted file mode 100644 index f151e9d74..000000000 --- a/docs/class-reference-items.md +++ /dev/null @@ -1,263 +0,0 @@ -# Items - -## Items Repository - - -### `public function get_cpt_labels()` - -Get generic labels for the custom post types created for each collection - - -**Returns:** `array` — Labels in the format expected by register_post_type() - -### `public function register_post_type()` - -Register each Item post_type {@inheritDoc} - - -### `public function fetch( $args = [], $collections = [], $output = null )` - -fetch items based on ID or WP_Query args - -Items are stored as posts. Check WP_Query docs to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/) You can also use a mapped property, such as name and description, as an argument and it will be mapped to the appropriate WP_Query argument - -The second paramater specifies from which collections item should be fetched. You can pass the Collection ID or object, or an Array of IDs or collection objects - - -**Parameters:** - -* `$args` — array — WP_Query args || int $args the item id -* `$collections` — array — Array Entities\Collection || Array int collections IDs || int collection id || Entities\Collection collection object -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `\WP_Query|Array` — an instance of wp query OR array of entities; - -### `if ( ! isset( $args['post_status'] ) )` - -If no specific status is defined in the query, WordPress will fetch public items and private items for users withe the correct permission. - -If a collection is private, it must have the same behavior, despite its items are public or not. - - -### `public function fetch_ids( $args = [], $collections = [] )` - -fetch items IDs based on WP_Query args - -to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/) You can also use a mapped property, such as name and description, as an argument and it will be mapped to the appropriate WP_Query argument - -The second paramater specifies from which collections item should be fetched. You can pass the Collection ID or object, or an Array of IDs or collection objects - - -**Parameters:** - -* `$args` — array — WP_Query args || int $args the item id -* `$collections` — array — Array Entities\Collection || Array int collections IDs || int collection id || Entities\Collection collection object - -**Returns:** `Array` — array of IDs; - -### `public function delete( $args )` - - -**Parameters:** - -* `(` — $args — is a array like [post_id, [is_permanently => bool]] ) - -**Returns:** mixed|Entities\Item - -### `public function title_in_posts_where( $where, $wp_query )` - -allow wp query filter post by array of titles - - -**Returns:** string - -### `public function content_in_posts_where( $where, $wp_query )` - -allow wp query filter post by array of content - - -**Returns:** string - - - -## Item Entity - - -### `class Item extends Entity` - -Represents the Entity Item - - -### `protected $repository = 'Items'` - -{@inheritDoc} -### `function __construct( $which = 0 )` - -{@inheritDoc} - - -### `function set_terms( $value )` - - -### `function get_terms()` - - -**Returns:** mixed|null - -### `function get_attachments()` - - -**Returns:** array - -### `function get_author_name()` - - -**Returns:** string - -### `function get_featured_image()` - - -**Returns:** false|string - -### `function set_featured_img_id( $id )` - - -### `function get_featured_img_id()` - - -**Returns:** int|string - -### `function get_modification_date()` - - -**Returns:** mixed|null - -### `function get_creation_date()` - - -**Returns:** mixed|null - -### `function get_author_id()` - - -**Returns:** mixed|null - -### `function get_url()` - - -**Returns:** mixed|null - -### `function get_id()` - -Return the item ID - - -**Returns:** integer - -### `function get_title()` - -Return the item title - - -**Returns:** string - -### `function get_order()` - -Return the item order type - - -**Returns:** string - -### `function get_parent()` - -Return the parent ID - - -**Returns:** integer - -### `function get_description()` - -Return the item description - - -**Returns:** string - -### `public function get_db_identifier()` - - - -{@inheritDoc} -### `public function get_capabilities()` - -Use especial Item capabilities {@inheritDoc} - - -### `function set_title( $value )` - -Define the title - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_order( $value )` - -Define the order type - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_parent( $value )` - -Define the parent ID - - -**Parameters:** - -* `$value` — [integer] - -**Returns:** void - -### `function set_description( $value )` - -Define the description - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function get_fields()` - -Return a List of ItemMetadata objects - -It will return all metadata associeated with the collection this item is part of. - -If the item already has a value for any of the metadata, it will be available. - - -**Returns:** `array` — Array of ItemMetadata objects - -### `protected function set_cap()` - -set meta cap object - - -### `function validate()` - - - -{@inheritDoc} -### `public function validate_core_fields()` - -{@inheritDoc} - \ No newline at end of file diff --git a/docs/class-reference-logs.md b/docs/class-reference-logs.md deleted file mode 100644 index f07c89e2e..000000000 --- a/docs/class-reference-logs.md +++ /dev/null @@ -1,237 +0,0 @@ -# Logs - -## Logs Repository - - -### `class Logs extends Repository` - -Implement a Logs system - - -### `public function register_post_type()` - - - -{@inheritDoc} -### `public function fetch($args = [], $output = null)` - -fetch logs based on ID or WP_Query args - -Logs are stored as posts. Check WP_Query docs to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/) You can also use a mapped property, such as name and description, as an argument and it will be mapped to the appropriate WP_Query argument - - -**Parameters:** - -* `$args` — array — WP_Query args || int $args the log id -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `\WP_Query|Array` — an instance of wp query OR array of entities; - -### `public function insert_log($new_value, $value = null)` - -Insert a log when a new entity is inserted -**Parameters:** - -* `$new_value` — Entity -* `$value` — Entity - -**Returns:** `Entities\Log` — new created log - -### `public function approve($log)` - - - - -**Parameters:** - -* `$log` — Entities\Log - -**Returns:** `Entities\Entity|boolean` — return insert/update valeu or false - -### `$value = $log->get_value()` - - - - -## Log Entity - - -### `class Log extends Entity` - -Represents entity Log - - -### `protected $repository = 'Logs'` - -{@inheritDoc} -### `function get_title()` - -Return the Log title - - -**Returns:** string - -### `function get_order()` - -Return the log order type - - -**Returns:** string - -### `function get_parent()` - -Retun the parent ID - - -**Returns:** integer - -### `function get_description()` - -Return the Log description - - -**Returns:** string - -### `function get_blog_id()` - -Return the ID of blog - - -**Returns:** integer - -### `function get_user_id()` - -Return User Id of who make the action - - -**Returns:** `int` — User Id of logged action - -### `public function get_value()` - -Get value of log entry - - -**Parameters:** - -* `$value` — mixed - -**Returns:** void - -### `public function get_old_value()` - -Get old value of log entry object - - -**Parameters:** - -* `$value` — mixed - -**Returns:** void - -### `function set_title($value)` - -Set log tittle - - -**Parameters:** - -* `$value` — string - -**Returns:** void - -### `function set_order($value)` - -Define the order type - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `function set_parent($value)` - -Define the parent ID - - -**Parameters:** - -* `$value` — [integer] - -**Returns:** void - -### `function set_description($value)` - -Define the Log description - - -**Parameters:** - -* `$value` — [string] - -**Returns:** void - -### `protected function set_user_id($value = 0)` - -Define the user ID of log entry - - -**Parameters:** - -* `$value` — [integer] - -**Returns:** void - -### `protected function set_blog_id($value = 0)` - -Define the blog ID of log entry - - -**Parameters:** - -* `$value` — [integer] - -**Returns:** void - -### `protected function set_value($value = null)` - -Define the value of log entry - - -**Parameters:** - -* `$value` — [mixed] - -**Returns:** void - -### `protected function set_old_value($value = null)` - -Set old value of log entry - - -**Parameters:** - -* `$value` — [mixed] - -**Returns:** void - -### `public static function create($msn = false, $desc = '', $new_value = null, $old_value = null, $status = 'publish')` - - - - -**Parameters:** - -* `$msn` — boolean|string -* `$desc` — string -* `$new_value` — mixed -* `$old_value` — mixed -* `$status` — string — 'publish', 'private' or 'pending' - -**Returns:** \Tainacan\Entities\Log - -### `public function approve()` - -{@inheritDoc} - \ No newline at end of file diff --git a/docs/class-reference-taxonomies.md b/docs/class-reference-taxonomies.md deleted file mode 100644 index 67ff55554..000000000 --- a/docs/class-reference-taxonomies.md +++ /dev/null @@ -1,143 +0,0 @@ -# Taxonomies - -## Taxonomies Repository - - -### `class Taxonomies extends Repository` - -Class Tainacan_Taxonomies - - -### `public function get_cpt_labels()` - -Get the labels for the custom post type of this repository -**Returns:** `array` — Labels in the format expected by register_post_type() - -### `public function insert($taxonomy)` - - -**Parameters:** - -* `$taxonomy` — Entities\Taxonomy - -**Returns:** Entities\Entity - -### `public function fetch( $args = [], $output = null )` - -fetch taxonomies based on ID or WP_Query args - -Taxonomies are stored as posts. Check WP_Query docs to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/) You can also use a mapped property, such as name and description, as an argument and it will be mapped to the appropriate WP_Query argument - - -**Parameters:** - -* `$args` — array — WP_Query args | int $args the taxonomy id -* `$output` — string — The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values) - -**Returns:** `\WP_Query|Array` — an instance of wp query OR array of entities; - - - -## Taxonomy Entity - - -### `class Taxonomy extends Entity` - -Represents the Entity Taxonomy - - -### `protected static $post_type = 'tainacan-taxonomy'` - -{@inheritDoc} -### `protected static $capability_type = ['tainacan-taxonomy', 'tainacan-taxonomies']` - -{@inheritDoc} -### `protected $repository = 'Taxonomies'` - -{@inheritDoc} -### `function register_taxonomy()` - -Register the taxonomy - - -**Returns:** bool - -### `function get_name()` - -Return the name - - -**Returns:** string - -### `function get_description()` - -Return the description - - -**Returns:** string - -### `function get_allow_insert()` - -Return true if allow insert or false if not allow insert - - -**Returns:** boolean - -### `function get_slug()` - -Return the slug - - -**Returns:** string - -### `function get_db_identifier()` - -Return the DB ID - - -**Returns:** bool|string - -### `function set_name($value)` - -Define the name of taxonomy - - -**Parameters:** - -* `$value` — [string] - -### `function set_slug($value)` - -Define the slug - - -**Parameters:** - -* `$value` — [string] - -### `function set_description($value)` - -Define the description - - -**Parameters:** - -* `$value` — [string] - -### `function set_allow_insert($value)` - -Define if allow insert or not - - -**Parameters:** - -* `$value` — [boolean] - -### `function validate()` - -Validate Taxonomy - - -**Returns:** bool - - \ No newline at end of file diff --git a/docs/class-reference-terms.md b/docs/class-reference-terms.md deleted file mode 100644 index aa9e8a7a8..000000000 --- a/docs/class-reference-terms.md +++ /dev/null @@ -1,142 +0,0 @@ -# Terms - -## Terms Repository - - -### `class Terms extends Repository` - -Class Tainacan_Terms -### `public function insert($term)` - - -**Parameters:** - -* `$term` — Entities\Entity - -**Returns:** Entities\Entity|Entities\Term - -### `public function fetch( $args = [], $taxonomies = [])` - -fetch terms based on ID or get terms args - -Terms are stored as WordPress regular terms. Check (@see https://developer.wordpress.org/reference/functions/get_terms/) get_terms() docs to learn all args accepted in the $args parameter - -The second paramater specifies from which taxonomies terms should be fetched. You can pass the Taxonomy ID or object, or an Array of IDs or taxonomies objects - - -**Parameters:** - -* `$args` — array — WP_Query args || int $args the term id -* `$taxonomies` — array — Array Entities\Taxonomy || Array int terms IDs || int collection id || Entities\Taxonomy taxonomy object - -**Returns:** `array` — of Entities\Term objects || Entities\Term - - - -## Term Entity - - -### `class Term extends Entity` - -Represents the Entity Term -### `protected $repository = 'Terms'` - -{@inheritDoc} -### `function __construct($which = 0, $taxonomy = false )` - -Term constructor. - - -**Parameters:** - -* `$which` — int -* `$taxonomy` — string - -### `function get_id()` - -Return the unique identifier - - -**Returns:** integer - -### `function get_name()` - -Return the name - - -**Returns:** string - -### `function get_parent()` - -Return the parent ID - - -**Returns:** integer - -### `function get_description()` - -Return the description - - -**Returns:** string - -### `function get_user()` - -Return the user ID - - -**Returns:** integer - -### `function get_taxonomy()` - -Return the taxonomy - - -**Returns:** integer - -### `function set_name($value)` - -Define the name - - -**Parameters:** - -* `$value` — [string] - -### `function set_parent($value)` - -Define the parent ID - - -**Parameters:** - -* `$value` — [integer] - -### `function set_description($value)` - -Define the description - - -**Parameters:** - -* `$value` — [string] - -### `function set_user($value)` - -Define the user associated - - -**Parameters:** - -* `$value` — [integer] - -### `function set_taxonomy($value)` - -Define the taxonomy associated - - -**Parameters:** - -* `$value` — [integer] - - \ No newline at end of file diff --git a/docs/internal-api.md b/docs/internal-api.md index cb4fbb6fb..e953b1963 100644 --- a/docs/internal-api.md +++ b/docs/internal-api.md @@ -4,16 +4,6 @@ This page shows how the internal API works and how to create and fetch all kinds Its important that you first get familiar with the [key concepts](key-concepts.md) of tainacan. -This page gives an overview of the API. Detailed documentation and reference on each entity can be found below: - -* [Collections Reference](class-reference-collections.md) -* [Items Reference](class-reference-items.md) -* [Item Metadata Reference](class-reference-item-metadata.md) -* [Metadata Reference](class-reference-metadata.md) -* [Filters Reference](class-reference-filters.md) -* [Taxonomies Reference](class-reference-taxonomies.md) -* [Terms Reference](class-reference-terms.md) -* [Logs Reference](class-reference-logs.md) ## Overview diff --git a/src/admin/admin-hooks-functions.php b/src/admin/admin-hooks-functions.php index de68e9af4..c4330828a 100644 --- a/src/admin/admin-hooks-functions.php +++ b/src/admin/admin-hooks-functions.php @@ -3,7 +3,7 @@ /** * @see \Tainacan\Admin_Hooks->register() */ -function register_admin_hook( $context, $callback, $position = 'end-left' ) { +function tainacan_register_admin_hook( $context, $callback, $position = 'end-left' ) { $admin_hooks = \Tainacan\Admin_Hooks::get_instance(); return $admin_hooks->register( $context, $callback, $position ); } \ No newline at end of file diff --git a/src/admin/components/other/checkbox-radio-modal.vue b/src/admin/components/other/checkbox-radio-modal.vue index 51f93dc74..e4b46da4a 100644 --- a/src/admin/components/other/checkbox-radio-modal.vue +++ b/src/admin/components/other/checkbox-radio-modal.vue @@ -1,8 +1,8 @@