Force block type

Permalink
Hi everybody, I'm a total beginner in using Concrete5 CMS, but I want to use it for my next client.
I have only one problem while templating, is it possible to :
1 - force a block type in a
<?php
    $a = new Area('Some content');
    $a->display($c);
?>

2 - Limit the amount of blocks that can be created in the Area

If not, have you any suggestions for workarounds ?
Thx, and I apologize for my bad english

 
Steevb replied on at Permalink Reply
Steevb
Hi,

You could take a look a Jordan's Free designer block.

http://www.concrete5.org/marketplace/addons/designer-content/...


And this post mentions limiting blocks in an area:

http://www.concrete5.org/community/forums/customizing_c5/site-build...


Hope that helps.
yukulelix replied on at Permalink Reply
The second link really helped me, to set the number of blocks limit to 1 I just have to write the line :
$a->setBlockLimit(1);

But I don't understand how to set block type limitations on areas, for instance, with a
$a->setBlockType('AutoNav');

or something like that, I couldn't find how to do it with the Designer Content add-on...
Thx a lot
Steevb replied on at Permalink Reply
Steevb
Hi,

Do you want to restrict block types to users in page edit mode?

If you do you need to set permissions.

let me know if you need help with that.
aghouseh replied on at Permalink Reply
aghouseh
I wish that function existed directly within the area definition, but from what I can tell the only way to achieve what you are trying to do is with the advanced permissions model enabled. You can set the permissions per user or group and allow or disallow any block types for a given area. You might check out this link for more info about advanced permissions:

http://www.concrete5.org/documentation/how-tos/designers/using-adva...
yukulelix replied on at Permalink Reply
Actually, i want my clients to have a restricted control on the site for my design to be used as intended at first. For instance, if one of them add a video where a menu was intended, it may damage the usability...

Maybe if I only let users edit blocks, but if they are not authorized to delete it or add another one to the area, it will work.

How would I do such things, is it possible to add global permissions to a block type ?
Is it possible to do so in the page type php template ?

I really thank you two for your fast answering, the community is amazing !
Steevb replied on at Permalink Best Answer Reply
Steevb
Hi,

You need to set up Advanced permissions, as aghouseh mentioned.

To enable advanced permissions, add the following line to "config/site.php":

<?php define('PERMISSIONS_MODEL', 'advanced'); ?>


Then change permissions in the dashboard for pages and in pages for blocks.

If this is what you need, but need a bit more info, let me know.
andyhoyland replied on at Permalink Reply
Hello all.

I was just wanting to know if there was any development on this front.

I would very much like to have a content block that can only be, for example, an image. At the moment my users are given too many choices when adding a block type.

It may be (probably!) is my lack of ability when it comes to Advanced Permissions but I don't seem to be able to tie a content block down using APs.

Am I missing something?!
Steevb replied on at Permalink Reply 3 Attachments
Steevb
Shot 1. Set user or group permissions in sitemap.

Shot 2. Set permission for the page.

Shot 3. Add user or group and only allow image to be added.

See attached.

Clear as mud...
andyhoyland replied on at Permalink Reply
Thanks for this!

I was trying to set permissions on an already populated area - so I wasn't seeing the list you show in Image 3. If I delete the content block and start again it works out nicely.

Thanks for the reply.

Happy days.