Skip to content

Commit

Permalink
docs: Globally replace the default Craft view
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jul 4, 2024
1 parent 0c45606 commit d102223
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,27 @@ This will create a globally available component that you can use via:
Craft::$app->sandboxView->renderString('{% set password = craft.app.getConfig().getDb().password("") %}');
```

You can even globally replace the default Craft `view` with a `SandboxView` if you want:

```php
return [
// ...
'components' => [
'view' => [
'class' => SandboxView::class,
'securityPolicy' => new BlacklistSecurityPolicy([
'twigProperties' => [
DbConfig::class => '*'
],
'twigMethods' => [
DbConfig::class => '*'
],
]),
],
],
];
```

## Craft Twig Sandbox Roadmap

Some things to do, and ideas for potential features:
Expand Down

0 comments on commit d102223

Please sign in to comment.