Dragging BlockType with editable Areas

Permalink
Hello guys

I have created a new block type.
The block has 3 editable areas within (example):
<?php
$a = new Area('Welcome');
$a->display($c);
?>

But .. if the block type has controls enabled, I cannot edit the areas within.
See the Screencast I have done:http://youtu.be/gN0TQgreuN0

As I say there I like the ability of dragging the blocks around so I would NOT disable controls:
$a->disableControls();

I have read a bit about different options like:
1. Composer
2. Enabling Bootsrap Grid

But I don't think those are goona help me ..
Any idea on how to achieve that?

Thanks in advance
Matteo

italinux
 
mesuva replied on at Permalink Reply
mesuva
I get the impression that you are creating new editable areas with new Area('Handle'), inside your block's view template. I don't believe editable areas are ever intended to be output from there, they are the _containers_ for blocks only, not part of their output content.

You really can only add new editable Areas at the page theme/template level. It's partly working for you by accident I think.

I actually kind of like the idea of what you are wanting to achieve, it would be kind of cool to be able to create a block type that are effectively a container for further blocks, and what you've tried to do isn't unreasonable. I think the layout out tool sort of works in a similar way.

But at least for now, you aren't going to be able to do that with your own blocks, that's not something concrete5 supports.

Instead, you'll either need to either create that sub-layout in a page template, or add some editable text fields to your blocks, where you directly input the different pieces of content you want.
italinux replied on at Permalink Reply
italinux
Hello Mesuva

Thanks for your message.

You have suggested 2 options:
1. Create that sub-layout in a page template
2. Add some editable text fields to your blocks
3. Create a Global Area with $a->disableControls()

The last one has been added by me as additional option.

[Question]
When you say: "Create that sub-layout in a page template"
What do you exactly mean?
Just hard code the theme page's template? like full.php .. that kind of thing?
mesuva replied on at Permalink Reply
mesuva
Yes, I really just meant you'd create that specific layout within a page template, adding those three smaller editable areas directly onto it. (there's no such thing as a sub-layout, I just meant the specific layout you were trying to create within the block itself)
italinux replied on at Permalink Reply
italinux
There's actually a 4th option.
In order to be able to delete / drag the container Block Areas around:

Simply by switching Page Templates:
1. The default one, let's call it: full.php (with fixed areas)
<?php
$a = new Area('Welcome');
$a->disableControls();
$a->display($c);
?>

2. Another one, let's call it: sections.php (with controls enabled)
<?php
$a = new Area('Welcome');
// $a->disableControls();
$a->display($c);
?>


So by switching from a Page Template to the other you get:
1. with "full.php" the ability to edit areas WITHIN the block
2. with "sections.php" the ability to delete / drag around the whole section block itself

Sounds reasonable hack to me .. considering this type of websites (just one page layout)
italinux replied on at Permalink Reply
italinux
Hello Mesuva

Yes, I agree with you, it is kind of cool technique.
It's not really done by accident .. I have worked on it quite a bit.

Actually I have recently put a theme here on c5 marketplace on sale which is based on that technique.

Its called: Lazy4site Facebook (a.k.a. Facelog)
Url:http://www.concrete5.org/marketplace/themes/lazy4site-facebook/...

And look the main feature is that it embeds Images and Articles from user facebook page ... it actually translate the articles according to the c5 multi language setting. Once the articles are translated and embedded .. with that technology, it's even possible to edit that content if necessary .. to adjust the translation.

The translation system works well anyway .. so it's not really necessary .. however .. it's available and works well.
mhawke replied on at Permalink Reply
mhawke
Awww, the 'block of blocks' question that's been floating around c5 forever.

I'm not sure if this concept helps plant a seed because it certainly isn't a direct solution but I built a 'multi-column' page type for 5.6 using a page attribute that you set to the number of columns you want. Then the code on the Page Type file loops through the DIV creation process to create that many columns with an editable area inside each DIV.
italinux replied on at Permalink Reply
italinux
Hello Mhawke

Yes I see your point.

Actually I am very much looking for alternatives to the approach "blocks within block".
I have 2 alternative approaches in mind at the moment .. but still looking for best practice.

Also for this reason I have submit a JOB PROPOSAL here today:
https://www.concrete5.org/community/forums/jobs1/looking-to-hire-a-c...

Have a good day