Skip to content

Commit 2766145

Browse files
Merge branch 'main' into simplify-updating-bard-configs-in-fieldsets
2 parents 3280c47 + 89f76a0 commit 2766145

40 files changed

+1736
-191
lines changed

CHANGELOG.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,78 @@
11
# Changelog
22

3+
## 1.7.3 (2025-01-29)
4+
5+
### What's fixed
6+
* Fixed issue where deeply nested images in Bard fields were not being imported correctly #85 by @tdondich
7+
8+
9+
10+
## 1.7.2 (2025-01-14)
11+
12+
### What's fixed
13+
* Fixed taxonomy terms not being imported correctly #83 by @duncanmcclean
14+
15+
16+
17+
## 1.7.1 (2025-01-09)
18+
19+
### What's fixed
20+
* Fixed formatting issues when importing Classic Editor content from WordPress #81 by @duncanmcclean
21+
* Reverted "Fix import issue with Bard" #79 by @duncanmcclean
22+
23+
24+
25+
## 1.7.0 (2025-01-07)
26+
27+
### What's new
28+
* Added support for the List fieldtype #75 by @carstenjaksch
29+
* Added support for importing date ranges #78 by @duncanmcclean
30+
* Added support for importing alt text for multiple assets at once #74 by @carstenjaksch
31+
* Now, only the Bard buttons used by your content will be enabled #77 by @duncanmcclean
32+
* Added note to the docs about importing multiple values #70 by @carstenjaksch
33+
34+
### What's fixed
35+
* Fixed existing assets check when using the "Folder" option #73 by @carstenjaksch
36+
37+
38+
39+
## 1.6.0 (2024-12-20)
40+
41+
### What's new
42+
- Multi-site taxonomy support #67 by @duncanmcclean
43+
- Added "Blueprint" option when configuring entry & term imports #64 by @duncanmcclean
44+
- Downloaded assets can now be processed using your asset container's source preset #59 by @duncanmcclean
45+
- Added a progress indicator when saving / running an import by @duncanmcclean
46+
- Added a tooltip when hovering over a field name in the mappings table by @duncanmcclean
47+
- The "Unique Field" option has been removed from term & user imports. The Slug and Email will be used instead #66 by @duncanmcclean
48+
49+
### What's fixed
50+
- Fixed import issue with Bard #65 by @duncanmcclean
51+
52+
53+
54+
## 1.5.1 (2024-12-10)
55+
56+
### What's fixed
57+
* Fixed error when importing structured collection without mapping "Parent" field #58 by @duncanmcclean
58+
* A banner will now be displayed when a database hasn't been configured #56 by @duncanmcclean
59+
60+
61+
62+
## 1.5.0 (2024-11-29)
63+
64+
### What's new
65+
* You can now import asset alt text #50 by @duncanmcclean
66+
* The current file is now shown in the edit form #47 by @duncanmcclean
67+
* PHP 8.4 Support #41 by @duncanmcclean
68+
69+
### What's fixed
70+
* Null values are now filtered out when saving mappings #48 by @duncanmcclean
71+
* Bumped `cross-spawn` from 7.0.3 to 7.0.6 #46 by @dependabot[bot]
72+
* Fixed error when updating Bard configs inside fieldsets #22 by @duncanmcclean
73+
74+
75+
376
## 1.4.1 (2024-11-21)
477

578
### What's fixed

DOCUMENTATION.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Installation
22

3+
> **Note:**
4+
> Before installing the importer addon, please ensure your project has a database configured. The importer uses a database to keep track of import progress. If you created your site using the [Statamic CLI](https://github.com/statamic/cli), a SQLite database will have been setup for you. You can confirm by running `php artisan migrate`.
5+
36
1. You can install the Importer addon via Composer:
47

58
```bash
@@ -17,6 +20,7 @@ Before importing, you will need to do some preparation:
1720
* Ensure you have either a CSV or XML file to import.
1821
* You will need to produce separate files for each type of content you wish to import. For example: one file for Page entries, one for Blog entries, another for Users, etc.
1922
* When you're uploading a CSV, the CSV needs to have a header row.
23+
* Some fields allow importing multiple values. In this case, values should be separated by a pipe (`|`).
2024
* When you're coming from WordPress, please see the [WordPress](#wordpress) section below.
2125
* Create the necessary collections and taxonomies in Statamic.
2226
* Configure the necessary blueprints for those collections and taxonomies.
@@ -29,13 +33,14 @@ Before importing, you will need to do some preparation:
2933
3. You can then map fields from your blueprint to fields/columns in your file.
3034
* Depending on the fieldtype, some fields may have additional options, like "Related Key" or "Create when missing". You can read more about these below.
3135
* Mapping is disabled for some fieldtypes, like the [Replicator fieldtype](https://statamic.dev/fieldtypes/replicator#content). If you wish to import these fields, you will need to build a [custom transformer](#transformers).
32-
4. You will also need to specify a "Unique Field". This field will be used to determine if an item already exists in Statamic.
36+
* When you're importing taxonomy terms into a non-default site (eg. not the _first_ site you created) and the slugs differ between sites, you can map the "Slug in Default Site" field to the slug of the term in the default site in order for the importer to match up the terms correctly.
37+
4. If you're importing entries, you will also need to specify a "Unique Field". This field will be used to determine if an entry already exists in Statamic.
3338
5. Then, run the import and watch the magic happen! ✨
3439

3540
You can run the importer as many times as you like as you tweak the mappings. It'll update existing content and create new content as needed.
3641

3742
#### Queueing
38-
If you're importing a lot of content, you may want to consider running a queue worker to handle the import in the background.
43+
If you're importing a lot of content or downloading a lot of assets, you may want to consider running a queue worker to handle the import in the background.
3944

4045
Assuming you have Redis installed, you can update the `QUEUE_CONNECTION` in your `.env` file to `redis` and then run:
4146

@@ -56,8 +61,12 @@ When you're configuring mappings for an Assets field, or a Bard field, a few add
5661
* **Download when missing?**
5762
* By default, when the importer comes across an asset it can't find in Statamic, it will skip it.
5863
* However, if you wish, the importer can download any missing assets for you into the configured asset container.
64+
* **Process downloaded images?**
65+
* Determine whether downloaded images should be processed using the asset container's [source preset](https://statamic.dev/image-manipulation#process-source-images).
5966
* **Folder**
6067
* By default, downloaded assets will use same folder structure as the original URL. If you'd like to download them into a specific folder, you can select one here.
68+
* **Alt Text**
69+
* Determine which field in the row contains the alt text for the asset. This option will only be shown when the Asset blueprint has an `alt` field.
6170

6271
When importing a Bard field, assets will only be imported when the "Container" config option has been set in the blueprint.
6372

@@ -80,6 +89,9 @@ While you *can* use WordPress' built-in export tool, it doesn't contain all the
8089

8190
Instead, we recommend using a plugin like [WP All Export](https://wordpress.org/plugins/wp-all-export/) to export your content. It allows you to customize the columns included in the export (like ACF fields, featured images, etc.) and it'll give you a CSV.
8291

92+
### Classic Editor
93+
If you're importing content from the Classic Editor into a [Bard field](https://statamic.dev/fieldtypes/bard#overview), you will likely want to enable the "WordPress: Replace double line-breaks with <p> tags" option, which will wrap any unwrapped text in `<p>` tags before importing it into Bard.
94+
8395
### Gutenberg
8496
Statamic's [Bard fieldtype](https://statamic.dev/fieldtypes/bard#overview) is the closest equivalent to WordPress' Gutenberg editor.
8597

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) Statamic Rad Pack
3+
Copyright (c) Statamic
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ composer require statamic/importer
1919

2020
You can find the Importer addon in the Control Panel under `Utilities > Importer`.
2121

22+
> **Note:**
23+
> Before installing the importer addon, please ensure your project has a database configured. The importer uses a database to keep track of import progress. If you created your site using the [Statamic CLI](https://github.com/statamic/cli), a SQLite database will have been setup for you. You can confirm by running `php artisan migrate`.
24+
2225
<!-- statamic:hide -->
2326
## Documentation
2427

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"require-dev": {
2222
"laravel/pint": "^1.18",
2323
"orchestra/testbench": "^8.28 || ^9.6.1",
24-
"phpunit/phpunit": "^10.5.35"
24+
"phpunit/phpunit": "^10.5.35",
25+
"spatie/laravel-ray": "^1.39"
2526
},
2627
"config": {
2728
"allow-plugins": {

lang/en/messages.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,26 @@
55
'utility_description' => 'Import entries, taxonomies, and users from XML and CSV files.',
66

77
'configuration_instructions' => 'You can add or modify your Blueprint fields to customize what data is imported and what fieldtype it will be stored in. You can save, refresh, and come back to this import config later until it\'s ready to run.',
8+
'destination_blueprint_instructions' => 'Select which blueprint should be used for imported content.',
89
'destination_collection_instructions' => 'Select the collection to import entries into.',
910
'destination_site_instructions' => 'Which site should the entries be imported into?',
1011
'destination_taxonomy_instructions' => 'Select the taxonomy to import terms into.',
1112
'destination_type_instructions' => 'Choose what type of data are you importing.',
12-
'import_file_instructions' => 'Upload a CSV or XML file to import. This will replace the current file.',
13-
'import_file_instructions_create' => 'Upload a CSV or XML file to import.',
13+
'import_file_instructions' => 'Upload a CSV or XML file to import.',
1414
'import_name_instructions' => 'Name this import so you can identify it later.',
1515
'mapping_instructions' => 'Map the fields from your import to the fields in your blueprint.',
1616
'strategy_instructions' => 'Choose what should happen when importing.',
1717
'unique_field_instructions' => 'Select a "unique field" to determine if an item already exists.',
1818

19+
'assets_alt_instructions' => 'Which field should be used for the alt text?',
1920
'assets_base_url_instructions' => 'The base URL to prepend to the path.',
2021
'assets_download_when_missing_instructions' => 'If the asset can\'t be found in the asset container, should it be downloaded?',
2122
'assets_folder_instructions' => 'By default, downloaded assets will use same folder structure as the original URL. You can specify a different folder here.',
2223
'assets_related_field_instructions' => 'Which field does the data reference?',
24+
'assets_process_downloaded_images_instructions' => 'Should downloaded images be processed using the asset container\'s source preset?',
25+
'bard_wp_auto_p_instructions' => "You may want to enable this if you're importing from the Classic Editor.",
26+
'date_start_date_instructions' => 'Which field should be used for the start date?',
27+
'date_end_date_instructions' => 'Which field should be used for the end date?',
2328
'entries_create_when_missing_instructions' => 'Create the entry if it doesn\'t exist.',
2429
'entries_related_field_instructions' => 'Which field does the data reference?',
2530
'terms_create_when_missing_instructions' => 'Create the term if it doesn\'t exist.',

lang/en/validation.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
return [
44
'file_type_not_allowed' => 'Only CSV and XML files can be imported at this time.',
5+
'mappings_email_missing' => 'The Email field must be mapped on user imports.',
56
'mappings_not_provided' => 'You must map at least one field.',
7+
'mappings_slug_missing' => 'The Slug field must be mapped on taxonomy term imports.',
68
'site_not_configured_in_collection' => 'The chosen collection is not available on this site.',
9+
'site_not_configured_in_taxonomy' => 'The chosen taxonomy is not available on this site.',
710
'unique_field_without_mapping' => 'Please configure a mapping for this field.',
811
'uploaded_file_not_found' => 'The uploaded file could not be found.',
912
];

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/components/EditImportForm.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212
</div>
1313

14-
<div v-if="batchesTableMissing" class="text-xs border border-yellow-dark rounded p-4 bg-yellow dark:bg-dark-blue-100 dark:border-none">
14+
<div v-if="batchesTableMissing" class="text-xs border border-yellow-dark rounded p-4 bg-yellow dark:bg-dark-blue-100 dark:border-none mb-6">
1515
<div class="font-bold mb-2">{{ __('Please run your migrations.') }}</div>
1616
<p v-html="__('importer::messages.migrations_needed')"></p>
1717
</div>
@@ -135,5 +135,11 @@ export default {
135135
}
136136
},
137137
},
138+
139+
watch: {
140+
saving(saving) {
141+
this.$progress.loading(`${this.publishContainer}-import-edit-form`, saving);
142+
},
143+
}
138144
}
139145
</script>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<template>
2+
<v-select
3+
searchable
4+
:options="options"
5+
:get-option-label="(option) => option.title"
6+
:get-option-key="(option) => option.handle"
7+
:value="value"
8+
:reduce="opt => opt.handle"
9+
@input="update($event)"
10+
/>
11+
</template>
12+
13+
<script>
14+
export default {
15+
mixins: [Fieldtype],
16+
17+
inject: ['storeName'],
18+
19+
mounted() {
20+
if (! this.value && this.type && (this.collection || this.taxonomy)) {
21+
this.$emit('input', this.options[0].handle);
22+
}
23+
},
24+
25+
computed: {
26+
type() {
27+
return this.$store.state.publish[this.storeName].values.destination.type;
28+
},
29+
30+
collection() {
31+
return this.$store.state.publish[this.storeName].values.destination.collection[0];
32+
},
33+
34+
taxonomy() {
35+
return this.$store.state.publish[this.storeName].values.destination.taxonomy[0];
36+
},
37+
38+
options() {
39+
if (this.type === 'entries') {
40+
return this.meta.collectionBlueprints[this.collection];
41+
}
42+
43+
if (this.type === 'terms') {
44+
return this.meta.taxonomyBlueprints[this.taxonomy];
45+
}
46+
},
47+
},
48+
49+
watch: {
50+
type() {
51+
this.$emit('input', null);
52+
},
53+
54+
collection() {
55+
this.$emit('input', this.options[0].handle);
56+
},
57+
58+
taxonomy() {
59+
this.$emit('input', this.options[0].handle);
60+
},
61+
}
62+
}
63+
</script>

0 commit comments

Comments
 (0)