edalzell / statamic-forma

Give your Statamic addons a beautiful CP configuration page
MIT License
8 stars 4 forks source link

Return value of Edalzell\Forma\ConfigController::preProcess() must be of the type array, null returned #3

Closed sandersjj closed 3 years ago

sandersjj commented 3 years ago

Hey Erin,

First of all thanks for this plugin. In the serviceprovider of my plugin I added

$this->app->booted(function(){
            Forma::add('myaddon/test');
});

I also created a config.yaml:

api_key:
  display: 'Api Key'
  type: text
  read_only: true

But when I go to the setting page in my Control panel I get:

Return value of Edalzell\Forma\ConfigController::preProcess() must be of the type array, null returned 

In the manual it says that the second parameter in the add method is optional.

edalzell commented 3 years ago

Do you have a test.php config file in config/?

sandersjj commented 3 years ago

No, I don't have a test.php in config/.

edalzell commented 3 years ago

You’ll need a config file, and then publish it.

sandersjj commented 3 years ago

Can you elaborate on it? I don't see it in the readme. I also checked https://github.com/silentzco/statamic-mailchimp, but I didn't see how to do it.

edalzell commented 3 years ago

If you're going to have a config file, you need to actually have one in your package, see here: https://github.com/silentzco/statamic-mailchimp/tree/main/config.

This is not really a Forma thing...this is a Laravel thing. https://laravel.com/docs/8.x/packages#configuration

So if your addon is called Test you need a config/test.php in your addon. Then folks can publish it, then update it via Forma.