diff --git a/src/admin/class-tainacan-admin.php b/src/admin/class-tainacan-admin.php
index 8cafede8f..a1da50238 100644
--- a/src/admin/class-tainacan-admin.php
+++ b/src/admin/class-tainacan-admin.php
@@ -220,6 +220,13 @@ class Admin {
$class = new $metadata_type;
$settings['i18n']['helpers_label'][$class->get_component()] = $class->get_form_labels();
}
+
+ $filter_types = $Tainacan_Filters->fetch_filter_types();
+
+ foreach ( $filter_types as $index => $filter_type){
+ $class = new $filter_type;
+ $settings['i18n']['helpers_label'][$class->get_component()] = $class->get_form_labels();
+ }
$settings['form_hooks'] = Admin_Hooks::get_instance()->get_registered_hooks();
diff --git a/src/admin/components/edition/filter-edition-form.vue b/src/admin/components/edition/filter-edition-form.vue
index 4d47c5291..5647b51b4 100644
--- a/src/admin/components/edition/filter-edition-form.vue
+++ b/src/admin/components/edition/filter-edition-form.vue
@@ -149,11 +149,10 @@
+ v-model="editForm.filter_type_object.options"/>
@@ -66,18 +69,46 @@ class Numeric extends Filter_Type {
');
}
+ /**
+ * @inheritdoc
+ */
+ public function get_form_labels(){
+ return [
+ 'step' => [
+ 'title' => __( 'Step', 'tainacan' ),
+ 'description' => __( 'The amount to be increased or decreased when clicking on filter control buttons.', 'tainacan' ),
+ ]
+ ];
+ }
/**
* @param $filter
* @return string
* @internal param $metadatum
*/
public function render( $filter ){
- $options = $this->get_option('options');
- return '';
}
+
+
+ /**
+ * @param \Tainacan\Entities\Filter $filter
+ * @return array|bool true if is validate or array if has error
+ */
+ public function validate_options(\Tainacan\Entities\Filter $filter) {
+ if ( !in_array($filter->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )
+ return true;
+
+ if ( empty($this->get_option('step')) ) {
+ return [
+ 'step' => __('Required step','tainacan')
+ ];
+ }
+
+ return true;
+ }
}
\ No newline at end of file
diff --git a/src/classes/repositories/class-tainacan-filters.php b/src/classes/repositories/class-tainacan-filters.php
index cbc11e83a..ae803ebce 100644
--- a/src/classes/repositories/class-tainacan-filters.php
+++ b/src/classes/repositories/class-tainacan-filters.php
@@ -39,7 +39,7 @@ class Filters extends Repository {
'order' => [
'map' => 'menu_order',
'title' => __( 'Order', 'tainacan' ),
- 'type' => 'string',
+ 'type' => 'string/integer',
'description' => __( 'Filter order. This metadata is used if filters were manually ordered.', 'tainacan' ),
'validation' => ''
],
@@ -76,14 +76,14 @@ class Filters extends Repository {
'color' => [
'map' => 'meta',
'title' => __( 'Color', 'tainacan' ),
- 'type' => 'integer',
+ 'type' => 'integer/string',
'description' => __( 'Filter color', 'tainacan' ),
'validation' => ''
],
'metadatum' => [
'map' => 'meta',
'title' => __( 'Metadata', 'tainacan' ),
- 'type' => 'integer',
+ 'type' => 'array/object/string',
'description' => __( 'Filter metadata', 'tainacan' ),
'validation' => ''
],