mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
Add documentation for limiting allowed widgets
An addendum to clarify that yes, you can lock a WidgetArea down to certain widgets, and how to accomplish this.
This commit is contained in:
parent
0986537be7
commit
04dbb41125
@ -156,3 +156,14 @@ An example widget is below:
|
|||||||
<a href="$Link" rel="lightbox" title="$Title"><img src="$Image" alt="$Title" /></a>
|
<a href="$Link" rel="lightbox" title="$Title"><img src="$Image" alt="$Title" /></a>
|
||||||
<% end_control %>
|
<% end_control %>
|
||||||
|
|
||||||
|
## Limiting Allowed Widgets for a Pagetype
|
||||||
|
|
||||||
|
You can lock down a particular `WidgetAreaEditor` to only allow adding certain widgets by passing them as a second parameter.
|
||||||
|
|
||||||
|
**GreatPage.php**
|
||||||
|
|
||||||
|
:::php
|
||||||
|
$fields->addFieldToTab(
|
||||||
|
'Root.Widgets',
|
||||||
|
new WidgetAreaEditor('PhenomenalWidgetArea', ['ParticularlyEpicWidget', 'LessGreatWidget'])
|
||||||
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user