use filter to customize log message and update not post type classes insert

This commit is contained in:
Jacson Passold 2017-11-27 22:46:19 -02:00
parent 92d059c803
commit e4a0384a62
4 changed files with 5 additions and 13 deletions

View File

@ -23,7 +23,8 @@ class Item_Metadata extends Repository {
}
}
Entities\Log::create($this->log_message, $this->log_description, $item_metadata);
do_action('tainacan-insert', $item_metadata);
do_action('tainacan-insert-Item_Metadata_Entity', $item_metadata);
// return a brand new object
return new Entities\Item_Metadata_Entity($item_metadata->get_item(), $item_metadata->get_metadata());

View File

@ -160,6 +160,7 @@ class Logs extends Repository {
$type = get_class($new_value);
$msn = sprintf( esc_html__( 'a %s has been created/modified.', 'tainacan' ), $type );
}
$msn = apply_filters('tainacan-insert-log-message-title', $msn, $type, $new_value);
Entities\Log::create($msn, '', $new_value, $value);
}
}

View File

@ -9,17 +9,6 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
abstract class Repository {
protected $entities_type = '\Tainacan\Entities\Entity';
/**
*
* @var string Text to put on log Title, false to use default
*/
protected $log_message = false;
/**
*
* @var string Text to put on log Description, false for no description
*/
protected $log_description = false;
function __construct() {
add_action('init', array(&$this, 'register_post_type'));

View File

@ -62,7 +62,8 @@ class Terms extends Repository {
}
}
Entities\Log::create($this->log_message, $this->log_description, $term);
do_action('tainacan-insert', $term);
do_action('tainacan-insert-Term', $term);
return $term_inserted['term_id'];
}