Hardcode editable image into a custom theme
Permalink
I already how to add editable regions to a theme like so:
<?php
$a = new Area('Title');
$a->display($c);
?>
But if I wanted to add an image block that would be editable, how would I do that? I basically want the user to be able to change the image, but not treat the image like a fully editable region, so they cannot add different block types in.
I tried this:
<?php
$bt_headerimage = BlockType::getByHandle('image');
$bt_headerimage->controller->fID=1;
$bt_headerimage->render('view');
?>
Which seems to put the image in, but it isn't editable.
<?php
$a = new Area('Title');
$a->display($c);
?>
But if I wanted to add an image block that would be editable, how would I do that? I basically want the user to be able to change the image, but not treat the image like a fully editable region, so they cannot add different block types in.
I tried this:
<?php
$bt_headerimage = BlockType::getByHandle('image');
$bt_headerimage->controller->fID=1;
$bt_headerimage->render('view');
?>
Which seems to put the image in, but it isn't editable.
Thinking about this more... Deafult page types would get you part of the way there.http://www.concrete5.org/documentation/using-concrete5/dashboard/pa...
You could put the image block in that area and have it auto-populated with that block. BUT, the user would be able to remove it or change it. So, not an ideal solution.