add default property status

This commit is contained in:
Jacson Passold 2017-12-01 00:48:43 -02:00
parent 687740223f
commit 4c078ce953
1 changed files with 11 additions and 0 deletions

View File

@ -90,6 +90,11 @@ class Entity {
$this->set_validated(false);
$this->$prop = $value;
}
public function set_status($value){
$value = apply_filters('tainacan-set-post-status', $value);
$this->set_mapped_property('status', $value);
}
/**
* Validate the class values/properties, to be used before insert/save/update
@ -162,6 +167,12 @@ class Entity {
return static::$post_type;
}
public function get_status(){
$value = $this->get_mapped_property('status');
if(empty($value)) $value = 'draft';
return apply_filters('tainacan-get-post-status', $value);
}
public function add_error($type, $message) {
$this->errors[] = [$type => $message];
}