Skip to content

Commit 7460874

Browse files
committed
feat: add documentation for {viewcontext} and {appcontext}
1 parent 76acf75 commit 7460874

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

apps/frontend/content/docs/concepts/placeholders.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,26 @@ For example, you could use the `{webroot/public}` placeholder to add an image to
115115
<img src="{webroot/public}/cool_image.jpeg" />
116116
```
117117

118+
### Context
119+
120+
Context placeholders simplify otherwise complicated paths and generally improve compatibility.
121+
122+
#### Appcontext
123+
124+
Returns the namespace prefix for an extension's PHP classes.
125+
126+
| Placeholder | Output |
127+
| -------------- | ----------------------------------------------------- |
128+
| `{appcontext}` | Pterodactyl\BlueprintFramework\Extensions\myextension |
129+
130+
#### Viewcontext
131+
132+
Returns the view prefix for an extension's views.
133+
134+
| Placeholder | Output |
135+
| --------------- | -------------------------------- |
136+
| `{viewcontext}` | blueprint.extensions.myextension |
137+
118138
### Installer
119139

120140
Technical details about the framework handling the extension.

apps/frontend/content/docs/concepts/routing.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ In your `requests.app` directory (which is called `app` in this case), create a
7171
```php [app/FooController.php]
7272
<?php
7373
74-
// This is the namespace 'requests.app' lives in. {identifier}
75-
// is automatically replaced with your extension's identifier
76-
// upon installation.
77-
namespace Pterodactyl\BlueprintFramework\Extensions\{identifier};
74+
// This is the namespace 'requests.app' lives in. {appcontext}
75+
// is automatically corrected by Blueprint upon installing your
76+
// extension.
77+
namespace {appcontext};
7878
7979
use Pterodactyl\Http\Controllers\Controller;
8080
@@ -94,7 +94,7 @@ Finally, update your `requests.routers.web` router. Import the `requests.app` na
9494
<?php
9595
9696
use Illuminate\Support\Facades\Route;
97-
+ use Pterodactyl\BlueprintFramework\Extensions\{identifier};
97+
+ use {appcontext};
9898
9999
- Route::get('/foo', function () {
100100
- return 'bar';
@@ -142,7 +142,7 @@ Create a controller called `FizzController.php` and make it render the `fizz.bla
142142
```php [app/FizzController.php]
143143
<?php
144144
145-
namespace Pterodactyl\BlueprintFramework\Extensions\{identifier};
145+
namespace {appcontext};
146146
147147
use Pterodactyl\Http\Controllers\Controller;
148148
@@ -156,9 +156,9 @@ class FizzController extends Controller {
156156
// Create another index function, this time promising a view
157157
// to be returned.
158158
public function index(): View {
159-
// Make the view. 'requests.views' are always prefixed with
160-
// 'blueprint.extensions.{identifier}'.
161-
return $this->view->make('blueprint.extensions.{identifier}.fizz');
159+
// Render a view. Views should be prefixed with {viewcontext}
160+
// which is automatically replaced by Blueprint.
161+
return $this->view->make('{viewcontext}.fizz');
162162
}
163163
}
164164
```
@@ -169,7 +169,7 @@ Add the `/fizz` route to your `requests.routers.web` router.
169169
<?php
170170
171171
use Illuminate\Support\Facades\Route;
172-
use Pterodactyl\BlueprintFramework\Extensions\{identifier};
172+
use {appcontext};
173173
174174
Route::get('/foo', [FooController::class, 'index']);
175175
+ Route::get('/fizz', [FizzController::class, 'index']);

apps/frontend/content/docs/configs/confyml.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ Defines how Blueprint should handle your extension's web request routing and app
272272

273273
#### `requests.views`
274274

275-
Directory containing additional blade view files. Symlinked to `resources/views/blueprint/extensions/{identifier}` for Laravel's view system and accessible as `blueprint.extensions.{identifier}.*`.
275+
Directory containing additional blade view files. Symlinked to `resources/views/blueprint/extensions/{identifier}` and accessible as `{viewcontext}.my-view-name`.
276276

277277
```yaml [conf.yml]
278278
requests:
@@ -283,7 +283,7 @@ requests:
283283

284284
#### `requests.app`
285285

286-
Application logic and controllers directory. Symlinked to `app/BlueprintFramework/Extensions/{identifier}`.
286+
Application logic and controllers directory. Symlinked to `app/BlueprintFramework/Extensions/{identifier}`, accessible as `{appcontext}\MyClassName`.
287287

288288
```yaml [conf.yml]
289289
requests:

0 commit comments

Comments
 (0)