diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php index e425db100..9137ca466 100644 --- a/src/admin/tainacan-admin-i18n.php +++ b/src/admin/tainacan-admin-i18n.php @@ -30,7 +30,6 @@ return apply_filters( 'tainacan-admin-i18n', [ 'terms' => __( 'Terms', 'tainacan' ), 'mapping' => __( 'Mapping', 'tainacan' ), 'importers' => __( 'Importers', 'tainacan' ), - 'metadata' => __( 'metadata', 'tainacan' ), // Actions 'edit' => __( 'Edit', 'tainacan' ), @@ -101,9 +100,9 @@ return apply_filters( 'tainacan-admin-i18n', [ 'title_collection_filters_edition' => __( 'Edit Filters of', 'tainacan' ), 'title_importer_page' => __( 'Importer', 'tainacan' ), 'title_importers_page' => __( 'Importers', 'tainacan' ), - 'title_export_collection_page' => __( 'Export Collection Page', 'tainacan' ), - 'title_export_item_page' => __( 'Export Item Page', 'tainacan' ), - 'title_export_page' => __( 'Export Page', 'tainacan' ), + 'title_export_collection_page' => __( 'Export Collection Page', 'tainacan' ), + 'title_export_item_page' => __( 'Export Item Page', 'tainacan' ), + 'title_export_page' => __( 'Export Page', 'tainacan' ), // Labels (used mainly on Aria Labels and Inputs) 'label_clean' => __( 'Clear', 'tainacan' ), @@ -133,8 +132,8 @@ return apply_filters( 'tainacan-admin-i18n', [ 'label_button_delete_header_image' => __( 'Button Delete Header Image', 'tainacan' ), 'label_button_edit_thumb' => __( 'Button Edit Thumbnail', 'tainacan' ), 'label_button_edit_header_image' => __( 'Button Edit Header Image', 'tainacan' ), - 'label_button_edit_document' => __( 'Button Edit Document', 'tainacan' ), - 'label_button_delete_document' => __( 'Button Delete Document', 'tainacan' ), + 'label_button_edit_document' => __( 'Button Edit Document', 'tainacan' ), + 'label_button_delete_document' => __( 'Button Delete Document', 'tainacan' ), 'label_choose_thumb' => __( 'Choose Thumbnail', 'tainacan' ), 'label_button_delete_thumb' => __( 'Button Delete Thumbnail', 'tainacan' ), 'label_collections_per_page' => __( 'Collections per Page:', 'tainacan' ), @@ -247,18 +246,17 @@ return apply_filters( 'tainacan-admin-i18n', [ 'label_remove_value' => __( 'Remove value', 'tainacan' ), 'label_create_new_page' => __( 'Create new page', 'tainacan' ), 'label_total_items' => __( 'Total items', 'tainacan' ), - 'label_see_more' => __( 'See more', 'tainacan' ), - 'label_until' => __( 'until', 'tainacan' ), - 'label_visibility' => __( 'Visibility', 'tainacan' ), - 'label_discart' => __( 'Discart', 'tainacan' ), - 'label_save_as_draft' => __( 'Save as draft', 'tainacan' ), - 'label_update_draft' => __( 'Update draft', 'tainacan' ), - 'label_return_to_draft' => __( 'Return to draft', 'tainacan' ), - 'label_publish' => __( 'Publish', 'tainacan' ), - 'label_send_to_trash' => __( 'Send to trash', 'tainacan' ), - 'label_update' => __( 'Update', 'tainacan' ), - 'label_mapper_metadata' => __( 'Mapper Metadata', 'tainacan' ), - 'label_add_more_mapper_metadata' => __( 'Add more mapper\'s metadata', 'tainacan' ), + 'label_see_more' => __( 'See more', 'tainacan' ), + 'label_until' => __( 'until', 'tainacan' ), + 'label_visibility' => __( 'Visibility', 'tainacan' ), + 'label_discart' => __( 'Discart', 'tainacan' ), + 'label_save_as_draft' => __( 'Save as draft', 'tainacan' ), + 'label_update_draft' => __( 'Update draft', 'tainacan' ), + 'label_return_to_draft' => __( 'Return to draft', 'tainacan' ), + 'label_publish' => __( 'Publish', 'tainacan' ), + 'label_update' => __( 'Update', 'tainacan' ), + 'label_mapper_metadata' => __( 'Mapper Metadata', 'tainacan' ), + 'label_add_more_mapper_metadata' => __( 'Add more mapper\'s metadata', 'tainacan' ), // Instructions. More complex sentences to guide user and placeholders 'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ), @@ -283,13 +281,12 @@ return apply_filters( 'tainacan-admin-i18n', [ 'instruction_search' => __( 'Search', 'tainacan' ), 'instruction_search_in_repository' => __( 'Search in repository', 'tainacan' ), 'instruction_select_a_target_collection' => __( 'Select a target collection', 'tainacan' ), - 'instruction_select_a_metadatum' => __( 'Select a metadatum', 'tainacan' ), - 'instruction_select_a_mapper' => __( 'Select a mapper', 'tainacan' ), + 'instruction_select_a_mapper' => __( 'Select a mapper', 'tainacan' ), 'instruction_select_an_importer_type' => __( 'Select an importer type from the options above:', 'tainacan' ), 'instruction_drop_file_or_click_to_upload' => __( 'Drop your source file or click here to upload.', 'tainacan' ), 'instruction_select_metadatum_type' => __( 'Select a metadatum type.', 'tainacan' ), 'instruction_configure_new_metadatum' => __( 'Configure new metadatum.', 'tainacan' ), - 'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ), + 'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ), // Info. Other feedback to user. 'info_search_results' => __( 'Search Results', 'tainacan' ), @@ -368,12 +365,12 @@ return apply_filters( 'tainacan-admin-i18n', [ 'info_updated_at' => __( 'Updated at', 'tainacan' ), 'info_editing_metadata_values' => __( 'Editing metadata values...', 'tainacan' ), 'info_updating_metadata_values' => __( 'Updating metadata values...', 'tainacan' ), - 'info_type_to_add_items' => __( 'Add items...', 'tainacan' ), - 'info_type_to_search_items' => __( 'Search items...', 'tainacan' ), - 'info_type_to_add_terms' => __( 'Add terms...', 'tainacan' ), - 'info_type_to_search_metadata' => __( 'Search metadata...', 'tainacan' ), - 'info_type_to_add_metadata' => __( 'Add metadata...', 'tainacan' ), - 'info_visibility_helper' => __( 'How the item will be available to visualization.', 'tainacan' ), + 'info_type_to_add_items' => __( 'Add items...', 'tainacan' ), + 'info_type_to_search_items' => __( 'Search items...', 'tainacan' ), + 'info_type_to_add_terms' => __( 'Add terms...', 'tainacan' ), + 'info_type_to_search_metadata' => __( 'Search metadata...', 'tainacan' ), + 'info_type_to_add_metadata' => __( 'Add metadata...', 'tainacan' ), + 'info_visibility_helper' => __( 'How the item will be available to visualization.', 'tainacan' ), 'info_errors_in_form' => __( 'There are errors in the form', 'tainacan' ), // Tainacan Metadatum Types diff --git a/src/importer/class-tainacan-test-importer.php b/src/importer/class-tainacan-test-importer.php index 0f4bcbfba..fcbba1f30 100644 --- a/src/importer/class-tainacan-test-importer.php +++ b/src/importer/class-tainacan-test-importer.php @@ -8,19 +8,6 @@ * used to learn how to write an importer and to * create test collections and items * - * Example how to invoke it - * - * add_action('init', function() { - * if ( isset($_GET['run_test_importer']) && $_GET['run_test_importer'] == 'go' ) { - * global $Tainacan_Importer_Handler; - * $test = new \Tainacan\Importer\Test_Importer(); - * $Tainacan_Importer_Handler->add_to_queue($test); - * } - * }); - * - * Put this code somewhere and access any URL of your site with ?run_test_importer=go - * - * TODO: check validate() methods and write log & abort importer in case of error. */ namespace Tainacan\Importer; @@ -70,8 +57,28 @@ class Test_Importer extends Importer { $this->items_repo = \Tainacan\Repositories\Items::get_instance(); $this->metadata_repo = \Tainacan\Repositories\Metadata::get_instance(); + $this->remove_import_method('file'); + $this->remove_import_method('url'); + + $this->set_default_options([ + 'items_col_1' => 20, + 'items_col_2' => 20 + ]); + } + public function options_form() { + + $form = ''; + $form .= ''; + + $form .= ''; + $form .= ''; + + return $form; + + } + public function create_taxonomies() { $tax1 = new Entities\Taxonomy(); @@ -324,10 +331,10 @@ class Test_Importer extends Importer { * Here we are just returning random values */ public function get_col1_number_of_items() { - return 10; + return $this->get_option('items_col_1'); } public function get_col2_number_of_items() { - return 20; + return $this->get_option('items_col_2'); } public function get_col1_item($index) {