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: README.md
+7-22Lines changed: 7 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -212,7 +212,13 @@ Instead of defining an array with values, you can also use a callable to manipul
212
212
213
213
### Advanced Example: Setting Template Classes at Runtime
214
214
215
-
Sometimes you need to add attributes to nested template elements, not just the main element. This plugin supports a special syntax to target specific templates within a helper's rendering process.
215
+
Sometimes you need to add attributes to parent template elements, not just the element where attributes are applied to (like Form::control). This plugin supports a special syntax to target specific templates within a helper's rendering process.
216
+
217
+
> [!IMPORTANT]
218
+
> This method only works on templates where the attribute is set on the element being rendered. For instance: the attribute is set on the input element, which is part of the inputContainer template. This works.
219
+
> For instance: Setting `label:class="class"` on form->control will not work because the input control where this attribute was set on is not rendered inside the label template. You can therefore only target template names that have the available attribute inside.
220
+
221
+
That said, a handy use case is controlling the wrapper attributes of Form->control:
216
222
217
223
**Example: Adding classes to the input container**
218
224
@@ -246,27 +252,6 @@ Which renders:
246
252
</div>
247
253
```
248
254
249
-
**Multiple template targeting:**
250
-
251
-
You can target multiple templates in a single call:
0 commit comments