Fixes category checkbox error, Changes Log Description and Title, Fixes css of pagination component
This commit is contained in:
parent
a3a239a435
commit
aae26b4cf7
|
@ -12,15 +12,15 @@
|
|||
:events="events"/>
|
||||
<!-- Footer -->
|
||||
<div
|
||||
class="table-footer"
|
||||
class="pagination-area"
|
||||
v-if="totalEvents > 0">
|
||||
<div class="shown-items">
|
||||
{{
|
||||
$i18n.get('info_showing_events') +
|
||||
(eventsPerPage * (page - 1) + 1) +
|
||||
$i18n.get('info_to') +
|
||||
getLastEventNumber() +
|
||||
$i18n.get('info_of') + totalEvents + '.'
|
||||
$i18n.get('info_showing_events') +
|
||||
(eventsPerPage * (page - 1) + 1) +
|
||||
$i18n.get('info_to') +
|
||||
getLastEventNumber() +
|
||||
$i18n.get('info_of') + totalEvents + '.'
|
||||
}}
|
||||
</div>
|
||||
<div class="items-per-page">
|
||||
|
|
|
@ -219,13 +219,13 @@ class Entity {
|
|||
foreach ($prop_value as $val) {
|
||||
if (!$validation->validate($val)) {
|
||||
|
||||
$this->add_error($prop, $message);
|
||||
$this->add_error($this->get_id() .' '. $prop, $message);
|
||||
$is_valid = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!$validation->validate($prop_value)) {
|
||||
$this->add_error($prop, $message);
|
||||
$this->add_error($this->get_id() .' '. $prop, $message);
|
||||
$is_valid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,20 @@ class Item_Metadata_Entity extends Entity {
|
|||
}
|
||||
|
||||
public function __toArray(){
|
||||
$as_array['value'] = $this->get_value();
|
||||
$value = $this->get_value();
|
||||
|
||||
if(is_array($value) && $value[0] instanceof Term){
|
||||
$values_arr = [];
|
||||
|
||||
foreach ($value as $val){
|
||||
$values_arr[] = $val->__toArray();
|
||||
}
|
||||
|
||||
$as_array['value'] = $values_arr;
|
||||
} else {
|
||||
$as_array['value'] = $this->get_value();
|
||||
}
|
||||
|
||||
$as_array['item'] = $this->get_item()->__toArray();
|
||||
$as_array['field'] = $this->get_field()->__toArray();
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
getValue(){
|
||||
if (this.field.value instanceof Array) {
|
||||
this.inputs = this.field.value;
|
||||
if (this.inputs.length == 0)
|
||||
if (this.inputs.length === 0)
|
||||
this.inputs.push('');
|
||||
} else {
|
||||
this.field.value == null || this.field.value == undefined ? this.inputs.push('') : this.inputs.push(this.field.value);
|
||||
|
|
|
@ -222,6 +222,15 @@ class Item_Metadata extends Repository {
|
|||
|
||||
if ($unique)
|
||||
$terms = reset($terms);
|
||||
|
||||
if(is_array($terms)){
|
||||
$terms_array = [];
|
||||
foreach ($terms as $term){
|
||||
$terms_array[] = new Entities\Term($term);
|
||||
}
|
||||
|
||||
return $terms_array;
|
||||
}
|
||||
|
||||
return $terms;
|
||||
|
||||
|
|
|
@ -228,6 +228,8 @@ class Logs extends Repository {
|
|||
*/
|
||||
public function log_inserts( $new_value, $value = null ) {
|
||||
$msn = "";
|
||||
$description = "";
|
||||
|
||||
if ( is_object( $new_value ) ) {
|
||||
// do not log a log
|
||||
if ( method_exists( $new_value, 'get_post_type' ) && $new_value->get_post_type() == 'tainacan-log' ) {
|
||||
|
@ -235,12 +237,20 @@ class Logs extends Repository {
|
|||
}
|
||||
|
||||
$type = get_class( $new_value );
|
||||
$msn = sprintf( esc_html__( 'a %s has been created/updated.', 'tainacan' ), $type );
|
||||
$class_name = explode('\\', $type)[2];
|
||||
|
||||
$name = method_exists($new_value, 'get_name') ? $new_value->get_name() :
|
||||
(method_exists($new_value, 'get_title') ? $new_value->get_title() : $new_value->get_field()->get_name());
|
||||
|
||||
$msn = sprintf( esc_html__( 'A %s has been created/updated.', 'tainacan' ), $class_name);
|
||||
$description = sprintf( esc_html__("The '%s' %s has been created/updated.", 'tainacan' ), $name, strtolower($class_name));
|
||||
|
||||
}
|
||||
|
||||
$msn = apply_filters( 'tainacan-insert-log-message-title', $msn, $type, $new_value );
|
||||
$description = apply_filters('tainacan-insert-log-description', $description, $type, $new_value);
|
||||
|
||||
return Entities\Log::create( $msn, '', $new_value, $value );
|
||||
return Entities\Log::create( $msn, $description, $new_value, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue