madebyraygun / craft-component-library

Craft CMS Plugin for Component Library
MIT License
2 stars 0 forks source link

feat: add and apply new preview setting to default context #38

Closed daltonrooney closed 2 weeks ago

daltonrooney commented 3 weeks ago

Closes #37

@vanrez-nez Any thoughts on applying the default preview this way?

vanrez-nez commented 3 weeks ago

@daltonrooney thanks! looks good to me, maybe one thing about the scope is that preview setting could be inside the browser subconfig key and then validate the existence like:

In Settings.php:

public array $browser = [
    'requiresLogin' => false,
    'enabled' => true,
    'path' => 'component-library',
    'welcome' => '',
    'preview' => '',
];
// ...
public function browserPreview(): string
{
    return $this->browser['preview'] ?? '@preview';
}