How can I seed a global blueprint?

Hello, everyone,

I noticed that the documentation only explains how Entry Blueprints can be seeded. I would need to seed globals though. Is that possible?

Greetings, Raphael

Hi Raphael,

This is a good point. There is no import or export models for globals yet. We will look at including one in a later release. For now, it may be possible to roll your own in the app/models directory. See the following documentation on these model types:

1 Like

+1 for this, I was creating a theme with some default global blueprint on install and I just discovered your thread that change lot of things :disappointed_relieved:

1 Like

+1, this would be really useful

Reporting back on this. We have improved the system to support importing Global Records. This will be introduced in v3.4 arriving soon.


Importing Tailor Globals

The class Tailor\Models\EntryRecordImport has been renamed to Tailor\Models\RecordImport, although both classes are available to avoid a breaking change. This means global blueprints can be imported using the new generic model instead. The class will automatically detect if the supplied blueprint UUID is a global or an entry.

1 Like

Hi @daft
can you tell me what I’m doing wrong?
Version is 3.4.14

my data.yaml looks like this:

…
-
    name: Global Settings
    class: Tailor\Models\RecordImport
    file: seeds/data/globals.json
    attributes:
        file_format: json
        blueprint_uuid: b641b833-d127-4be9-9900-900a6c3320c3
-
…

this is my globals.json

[
    {
        "website_name": "test",
        "turbo_router": 1,
        "smooth_scrolling": 1,
        "page_transitions": 1,
        "jquery": 0
    }
]

Unfortunately, the global settings are always skipped.
What am I doing wrong?

Global Settings: 0 Created / 0 Updated / 1 Skipped

Hey @Amin

It will skip if the record already exists. Try setting

attributes:
    update_existing: true

Hi @daft,
thank you for your answer. However, it was due to a missing "id" in the globals.json. update_existing: true is still a good hint and should also be included in the docs.

But what I noticed is that the fullslug is not exported via the export. This means that the entries have to be saved again after the import in order to be displayed if the identifier = "fullslug".

If I manually enter the fullslug into the import, it works as expected.

And it would be nice to have an additional permission for import/export, as at least most of my clients don’t need this function…but I as admin do.

Yes, it isn’t done automatically for performance reasons.