register the item post_type

This commit is contained in:
Jacson Passold 2017-11-27 22:37:59 -02:00
parent 60285252ad
commit 92d059c803
2 changed files with 15 additions and 3 deletions

View File

@ -54,8 +54,8 @@ class Collection extends Entity {
* This method register the post type for a collection, so that items can be created.
*
* @return void
*
function tainacan_register_post_type() {
*/
function register_collection_item_post_type() {
$cpt_labels = array(
'name' => 'Item',
'singular_name' => 'Item',
@ -98,7 +98,7 @@ class Collection extends Entity {
unregister_post_type($this->get_db_identifier());
register_post_type($cpt_slug, $args);
}*/
}
/**
* Get the collection ID

View File

@ -6,6 +6,7 @@ use Tainacan\Entities;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
use \Respect\Validation\Validator as v;
use Tainacan\Entities\Collection;
class Collections extends Repository {
protected $entities_type = '\Tainacan\Entities\Collection';
@ -79,6 +80,17 @@ class Collections extends Repository {
register_post_type(Entities\Collection::get_post_type(), $args);
}
/**
* @param Tainacan\Entities\Collection $collection
* {@inheritDoc}
* @see \Tainacan\Repositories\Repository::insert()
*/
public function insert($collection){
$new_collection = parent::insert($collection);
$collection->register_collection_item_post_type();
return $new_collection;
}
public function update($object){
}