Skip to content

Commit 4d88c19

Browse files
committed
docs: add section titles and descriptions
1 parent 7b45a2b commit 4d88c19

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

user_guide_src/source/outgoing/view_decorators.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,36 @@
22
View Decorators
33
###############
44

5+
.. contents::
6+
:local:
7+
:depth: 2
8+
9+
*************************
10+
What are View Decorators?
11+
*************************
12+
513
View Decorators allow your application to modify the HTML output during the rendering process. This happens just
614
prior to being cached, and allows you to apply custom functionality to your views.
715

16+
You can use View Decorators with :doc:`view_renderer` or :doc:`view_parser`.
17+
818
*******************
919
Creating Decorators
1020
*******************
1121

22+
Creating Decorator Class
23+
========================
24+
1225
Creating your own view decorators requires creating a new class that implements ``CodeIgniter\View\ViewDecoratorInterface``.
1326
This requires a single method that takes the generated HTML string, performs any modifications on it, and returns
1427
the resulting HTML.
1528

1629
.. literalinclude:: view_decorators/001.php
1730

18-
Once created, the class must be registered in ``app/Config/View.php``:
31+
Registering Decorator Class
32+
===========================
33+
34+
Once created, the class must be registered in **app/Config/View.php**:
1935

2036
.. literalinclude:: view_decorators/002.php
2137

user_guide_src/source/outgoing/view_decorators/002.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
class View extends BaseView
88
{
9+
// ...
10+
911
public array $decorators = [
1012
'App\Views\Decorators\MyDecorator',
1113
];
12-
13-
// ...
1414
}

0 commit comments

Comments
 (0)