Editable Static block and other

Permalink 1 user found helpful
Hi everybody !

I have some questions :

1/ If i add a specific block directly in the template, like this for example:

<?php
$mon_block= BlockType::getByHandle('autonav');
$mon_block->controller->displayPages = 'custom';
$mon_block->controller->orderBy = 'display_asc';
$mon_block->controller->displaySubPages = 'none';
$mon_block->controller->displayPagesCID = '56';
$mon_block->render('view');
?>

How to define if it is editable or not ? Is it possible ?

2/ What do the alias of Blocks and how to use it ?

3/ How to use the move () method of Blocks? examples?

4/ You can not instantiate the new Block () but this simply manipulate them?

Thank you in advance for your answers

orange73
 
orange73 replied on at Permalink Reply
orange73
Up!
mose replied on at Permalink Reply
mose
What is it that you are trying to accomplish that can't be solved with inserting the block into an area on the page?
orange73 replied on at Permalink Reply
orange73
I would like to define an area which can insert only one type of block (ex: autonav).

That why i inserted code sample above. But with this solution, i can't edit it !
orange73 replied on at Permalink Reply
orange73
Up!
goldfish replied on at Permalink Best Answer Reply
goldfish
Sounds like Advanced Permissions could help here, but when that's overkill and I just want something like footer navigation on every page without an editable area, I use this method:

Add your block to a global scrapbook (not the admin personal scrapbook) and name it "MyBlockName" and call the block by name in the appropriate spot in your template file <?php $b = Block::getByName('MyBlockName');
$b->display(); ?> It will not be editable inline, but you can edit via Scrapbook in the dashboard.
orange73 replied on at Permalink Reply
orange73
Ok thank you very much for this solution. :-)