mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
Merge pull request #140 from Cheddam/patch-1
Add documentation for limiting allowed widgets
This commit is contained in:
commit
40af14906d
@ -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