Limit Block Type that can be added to Area

Permalink 1 user found helpful
Hi All,

Does anyone know of a way to restrict the types of blocks that can be added to an area through code? I know I can restrict it through the area's permissions, but I'm looking for something that can be distributed as part of a package I am building. Any help would be appreciated!

Thanks!
C

 
Steevb replied on at Permalink Reply
Steevb
Example, not global:
<?php 
$a = new Area('Something');
$a->setBlockLimit(1);
$a->display($c);
?>
jacobs83 replied on at Permalink Reply
Thanks Steevb, I'm actually looking for something that will limit the type of blocks that a user can add, not necessarily the number of blocks. Something like:
<?php
$a = new Area('Something');
$a->setAllowedBlockTypes(array('block handle or id','block handle or id'));
$a->display($c);
?>

I'm pretty sure it's not possible, but wanted to reach out to the community to see if anyone has done something like this before.

Thanks!
Steevb replied on at Permalink Reply
Steevb
Sorry, my mistake, should have read post properly!!!
JohntheFish replied on at Permalink Reply
JohntheFish
I don't think you can do it short of overriding some core files and inserting your own code, in which case you may as well use permissions.

If you don't want the hassle of going through permissions piecemeal in the sitemap, you could look into writing code to set the permissions.