You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/outgoing/view_cells.rst
+10-4Lines changed: 10 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,8 +77,10 @@ Controlled Cells
77
77
78
78
.. versionadded:: 4.3.0
79
79
80
-
Controlled cells have two primary goals: to make it as fast as possible to build the cell, and provide additional logic and
81
-
flexibility to your views, if they need it. The class must extend ``CodeIgniter\View\Cells\Cell``. They should have a view file
80
+
Controlled cells have two primary goals: (1) to make it as fast as possible to build the cell, and (2) provide additional logic and
81
+
flexibility to your views, if they need it.
82
+
83
+
The class must extend ``CodeIgniter\View\Cells\Cell``. They should have a view file
82
84
in the same folder. By convention, the class name should be in PascalCase suffixed with ``Cell`` and the view should be
83
85
the snake_cased version of the class name, without the suffix. For example, if you have a ``MyCell`` class, the view file
84
86
should be ``my.php``.
@@ -89,7 +91,9 @@ should be ``my.php``.
89
91
Creating a Controlled Cell
90
92
==========================
91
93
92
-
At the most basic level, all you need to implement within the class are public properties. These properties will be made available to the view file automatically. Implementing the AlertMessage from above as a Controlled Cell would look like this:
94
+
At the most basic level, all you need to implement within the class are public properties. These properties will be made available to the view file automatically.
95
+
96
+
Implementing the AlertMessage from above as a Controlled Cell would look like this:
93
97
94
98
.. literalinclude:: view_cells/008.php
95
99
@@ -118,7 +122,9 @@ You can specify a custom view name by setting the ``view`` property in the class
118
122
Customize the Rendering
119
123
=======================
120
124
121
-
If you need more control over the rendering of the HTML, you can implement a ``render()`` method. This method allows you to perform additional logic and pass extra data the view, if needed. The ``render()`` method must return a string. To take advantage of the full features of controlled Cells, you should use ``$this->view()`` instead of the normal ``view()`` helper function:
125
+
If you need more control over the rendering of the HTML, you can implement a ``render()`` method. This method allows you to perform additional logic and pass extra data the view, if needed. The ``render()`` method must return a string.
126
+
127
+
To take advantage of the full features of controlled Cells, you should use ``$this->view()`` instead of the normal ``view()`` helper function:
0 commit comments