outl1ne / nova-page-manager

Static page and region manager for Laravel Nova - designed for headless CMS's.
MIT License
178 stars 38 forks source link

Struggling with getRegions and formatRegion helpers #132

Closed 1stevengrant closed 2 years ago

1stevengrant commented 2 years ago

I'm migrating from Nova 3 and of course updating page manager too.

Currently we have nova_get_regions() helper in code.

In order to see what I'm dealing with, I'm using Tinkerwell to callNPMHelpers::getRegions(); which errors with:

TypeError: Too few arguments to function App\Nova\Templates\Home::resolve(), 1 passed in /Sites/xxx/vendor/outl1ne/nova-page-manager/src/Helpers/NPMHelpers.php on line 149 and exactly 2 expected

When I attempt NPMHelpers::formatRegion('Home')

PHP Warning:  Attempt to read property "template" on string in /Sites/xxx/vendor/outl1ne/nova-page-manager/src/Helpers/NPMHelpers.php on line 139
null

Although I've migrated, I did take almost a clean approach to configuring this by deleting my old templates and generating new ones via artisan npm:template Home etc

Any insight as to what's wrong here? I did notice there's no guidance on migrating regions, only pages.

KasparRosin commented 2 years ago

Hey

Thanks for reporting, the first issue is indeed a bug from ourside. Try out version 5.5.4, it should resolve it.

Regarding NPMHelpers::formatRegion('Home'), this expects a model instance of a region. We can accept pull requests that implement getRegionByTemplate.