Skip to content

Commit ba07cfd

Browse files
committed
docs: add "Customizing Views"
1 parent 9dd8e44 commit ba07cfd

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

docs/customization/views.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Customizing Views
2+
3+
Shield provides the default view files, but they are sample files.
4+
Customization is recommended.
5+
6+
## Change $views
7+
8+
Change values in `$views` in the **app/Config/Auth.php** file.
9+
10+
For example, if you customize the login page, change the value for `'login'`:
11+
12+
```php
13+
public array $views = [
14+
'login' => '\App\Views\Shield\login', // changed this line.
15+
'register' => '\CodeIgniter\Shield\Views\register',
16+
'layout' => '\CodeIgniter\Shield\Views\layout',
17+
'action_email_2fa' => '\CodeIgniter\Shield\Views\email_2fa_show',
18+
'action_email_2fa_verify' => '\CodeIgniter\Shield\Views\email_2fa_verify',
19+
'action_email_2fa_email' => '\CodeIgniter\Shield\Views\Email\email_2fa_email',
20+
'action_email_activate_show' => '\CodeIgniter\Shield\Views\email_activate_show',
21+
'action_email_activate_email' => '\CodeIgniter\Shield\Views\Email\email_activate_email',
22+
'magic-link-login' => '\CodeIgniter\Shield\Views\magic_link_form',
23+
'magic-link-message' => '\CodeIgniter\Shield\Views\magic_link_message',
24+
'magic-link-email' => '\CodeIgniter\Shield\Views\Email\magic_link_email',
25+
];
26+
```
27+
28+
## Copy View File
29+
30+
Copy the file you want to customize in **vendor/codeigniter4/shield/src/Views/**
31+
to the **app/Views/Shield/** folder.
32+
33+
## Customize Content
34+
35+
Customize the content of the view file in **app/Views/Shield/** as you like.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ nav:
106106
- quick_start_guide/using_authorization.md
107107
- Customization:
108108
- customization/table_names.md
109+
- customization/views.md
109110
- customization/route_config.md
110111
- customization/redirect_urls.md
111112
- customization/validation_rules.md

0 commit comments

Comments
 (0)