Update all guides (NL + EN) for CodePress 2.5.2 features
- Admin guide: RBAC roles, role-based dashboard, plugin types (content/system) - CodePress developer guide: plugin types, admin plugin API, SCSS compilation, asset serving - Theme developer guide: SCSS sole CSS source, css_compiled read-only, guide layout - Content manager guide: layout selection from theme.json, plugin order in frontmatter - Both NL and EN updated with identical structure - 35 files updated
This commit is contained in:
@@ -2,18 +2,60 @@
|
||||
|
||||
## Frontend routing
|
||||
|
||||
Via `cms/router.php` for PHP dev server:
|
||||
Frontend routing goes through `cms/router.php` (PHP dev server) or `.htaccess` (Apache). Both provide clean URLs.
|
||||
|
||||
```php
|
||||
// Clean URLs: /nl/page
|
||||
// Query: ?page=page&lang=nl
|
||||
### PHP dev server
|
||||
|
||||
Start the server with:
|
||||
|
||||
```bash
|
||||
php -S localhost:8080 cms/router.php
|
||||
```
|
||||
|
||||
`cms/router.php` serves:
|
||||
- Clean URLs: `/nl/page` → `public/index.php?page=page&lang=nl`
|
||||
- `themes/` assets
|
||||
- `admin/assets/` assets
|
||||
- `plugins/` assets
|
||||
|
||||
### Apache (live server)
|
||||
|
||||
`public/.htaccess` rewrites URLs to `public/index.php`. Asset URLs (`/themes/`, `/admin/assets/`, `/plugins/`) are forwarded to `public/asset.php`.
|
||||
|
||||
`public/asset.php` serves files from the correct folders with the correct MIME type:
|
||||
- `/themes/<name>/assets/...` → `themes/<name>/assets/...`
|
||||
- `/admin/assets/...` → `admin/theme/default/assets/...`
|
||||
- `/plugins/<name>/assets/...` → `plugins/<name>/assets/...`
|
||||
|
||||
## Admin routing
|
||||
|
||||
Via `public/admin.php`:
|
||||
Admin routing goes through `public/admin.php` with clean URLs:
|
||||
|
||||
```
|
||||
/admin/dashboard → ?route=dashboard
|
||||
/admin/content → ?route=content
|
||||
/admin/plugins → ?route=plugins
|
||||
```
|
||||
|
||||
`cms/router.php` or `.htaccess` converts `/admin/<route>` to `?route=<route>`.
|
||||
|
||||
### Route access control (RBAC)
|
||||
|
||||
Each route is checked via `AdminAuth::hasPermission($route)`:
|
||||
- The `admin` role has wildcard `*` access
|
||||
- Other roles have an explicit list of allowed routes in `ROLE_PERMISSIONS`
|
||||
- Unauthorized routes return a **403 error**
|
||||
|
||||
## Plugin admin routing
|
||||
|
||||
System plugins can register admin routes. These are handled by `PluginManager::handleAdminRoute($route)`:
|
||||
|
||||
1. The system plugin registers routes via `getAdminRoutes()`
|
||||
2. `PluginManager::getAdminMenuItems()` collects admin menu items via `getAdminMenu()`
|
||||
3. On an admin request `PluginManager::handleAdminRoute($route)` finds a plugin that handles the route
|
||||
4. The plugin method `handleAdminRoute($route)` renders the page content
|
||||
|
||||
```php
|
||||
// Routes: /admin/dashboard, /admin/content, etc.
|
||||
// Query parameter: ?route=dashboard
|
||||
// PluginManager calls this for /admin/my-system
|
||||
$plugin->handleAdminRoute('my-system');
|
||||
```
|
||||
Reference in New Issue
Block a user