Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Ability to configure blueprint storage paths #10639

Open
wants to merge 8 commits into
base: 5.x
Choose a base branch
from

Conversation

jacksleight
Copy link
Contributor

@jacksleight jacksleight commented Aug 15, 2024

This PR adds the ability to configure the blueprint (and fieldset) storage paths.

There are two new config options under system where you can specify the paths:

    'blueprints_path' => resource_path('blueprints'),
    'fieldsets_path' => resource_path('fieldsets'),

Additionally the blueprints_path will accept an array, allowing you to have different paths for different types of blueprint. This is particularly useful for form blueprints when you want them to be located along with other editable content (ie. if you exclude content from git and don't want the form blueprints tracked):

    'blueprints_path' => [
        'default' => resource_path('blueprints'),
        'forms' => base_path('content/forms/blueprints'),
    ],

Notes

  • When specifying an array you should include a default path, which is the path that will be used for blueprint types you haven't explicitly specified.
  • Internally the repository will always store the directories as an array, even it it's just the single default one, but if I've done this right the change should be completely invisible and not affect any existing behaviour.
  • When a type directory is set the type is not appended when creating the path, so the above would give you content/forms/blueprints/contact.yaml not content/forms/blueprints/forms/contact.yaml. This required some additional changes in a couple of places but I think it makes sense.
  • There are two types of "namespace" in the repository, namespaces like "forms" and "collections", and also addon namespaces. This did get a bit confusing but hopefully the naming of the new methods make sense.
  • This does not affect custom addon/vendor blueprints, they will just go in the default path as before.

@jacksleight jacksleight changed the title Ability to configure blueprint storage paths [5.x] Ability to configure blueprint storage paths Aug 15, 2024
@jacksleight jacksleight marked this pull request as draft August 15, 2024 14:46
@jacksleight
Copy link
Contributor Author

jacksleight commented Aug 15, 2024

Got a test failure on this but can't figure out what the error is. It's happening in Tests\Feature\GraphQL\FormTest::it_queries_a_form_by_handle, but all I see from the request response is "Internal server error". Is there a way to see the actual exception that was thrown in the test request?

@jasonvarga
Copy link
Member

You can add config(['app.debug' => true]) to the start of that test and run it again to see a better error.

@jacksleight
Copy link
Contributor Author

You can add config(['app.debug' => true]) to the start of that test and run it again to see a better error.

Ah thanks! I'll give that a go.

@jacksleight jacksleight marked this pull request as ready for review August 19, 2024 14:31
src/Fields/BlueprintRepository.php Outdated Show resolved Hide resolved
@jacksleight
Copy link
Contributor Author

jacksleight commented Oct 1, 2024

Change made.

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