Skip to content

Conversation

@aerni
Copy link
Contributor

@aerni aerni commented Jan 5, 2026

I noticed that the blueprint fields don't contain new items after using $blueprint->setContents() in a listener. This PR ensures the blueprint cache is reset.

Left without PR. Right with PR. Notice the missing text field on the left.

CleanShot 2026-01-05 at 20 11 16@2x

You can reproduce the issue with this simple listener:

<?php

namespace App\Listeners;

use Statamic\Events\EntryBlueprintFound;

class ExtendBlueprint
{
    public function handle(EntryBlueprintFound $event): void
    {
        $contents = collect($event->blueprint->contents())
            ->dot()
            ->merge([
                'tabs.main.sections.0.fields.4.handle' => 'text',
                'tabs.main.sections.0.fields.4.field.type' => 'text',
            ])
            ->undot()
            ->all();

        dd($event->blueprint->setContents($contents)->fields()->all()->all());
    }
}

@jasonvarga jasonvarga merged commit ebb2068 into statamic:5.x Jan 5, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants