visualbuilder / email-templates

Email Template Editor for Filament
GNU General Public License v3.0
74 stars 19 forks source link

Visualbuilder\EmailTemplates\Resources\EmailTemplateResource::getSubNavigationPosition(): Return value must be of type Filament\Pages\SubNavigationPosition, null returned #7

Closed momostafa closed 4 months ago

momostafa commented 4 months ago

Hi,

after installation when trying to access domain.site/admin/email-templates I am getting below error

Visualbuilder\EmailTemplates\Resources\EmailTemplateResource::getSubNavigationPosition(): Return value must be of type Filament\Pages\SubNavigationPosition, null returned

I managed to fix it by commenting out below function vendor/visualbuilder/email-templates/src/Resources/EmailTemplateResource.php

    public static function getSubNavigationPosition(): SubNavigationPosition
    {
        return config('filament-email-templates.navigation.templates.position');

    }

and add this on top of the class

protected static SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Start;

and the same process for vendor/visualbuilder/email-templates/src/Resources/EmailTemplateThemeResource.php

Thanks a lot for this awesome plugin please keep it updated

cannycookie commented 4 months ago

Hi, Sorry about that, i've just pushed an update. You can modify the config file to include this option like this:-

 'navigation'         => [
        'templates' => [
            'sort'  => 40,
            'label'  => 'Email Templates',
            'icon' =>'heroicon-o-envelope',
             'group' => 'Content',
            'cluster' => false,
            'position' => \Filament\Pages\SubNavigationPosition:: Start
        ],
        'themes' => [
            'sort'  => 50,
            'label'  => 'Email Template Themes',
            'icon' =>'heroicon-o-paint-brush',
            'group' => 'Content',
            'cluster' =>false,
            'position' => \Filament\Pages\SubNavigationPosition:: Start
        ],
    ],

Note the group and cluster may be modified to your requirement. Glad you find the package useful.

momostafa commented 4 months ago

Thank you, for the prompt response, sure I find your plugin very useful and essential for any modern web application and I hope you will consider adding a simple frontend email testing and sending. Thanks again & Have a nice day

cannycookie commented 4 months ago

Testing your own templates is tricky one to implement as each mail class can have different models applied depending on the model.attribute tokens used in the email but yes it is something I do specifically for each installation with test models.

momostafa commented 4 months ago

Yes I totally understand