Hi, sorry but I am new to this system.
I wanted to create sections in blocks with image on the right, I followed this guide, but after the creation of the various blocks occur after saved you can not make more edits.
Where can I find an example of operation?
/////////////
$test_fields = array(
'Title/Intro' => array('type' => 'fieldset', 'label' => 'Title/Intro', 'class' => 'tab'),
'h1' => array('label' => 'Heading'),
'Sections' => array('type' => 'fieldset', 'label' => 'Sections', 'class' => 'tab'),
'sections' => array(
'type' => 'template',
'display_label' => FALSE,
'label' => 'Sections',
'add_extra' => FALSE,
'repeatable' => TRUE,
'max' => 4,
'min' => 0,
'title_field' => 'block',
'fields' => array(
'section' => array('type' => 'section', 'value' => 'Section {num}'),
'block' => array('type' => 'block', 'folder' => 'sections'),
),
),
);
$test_layout->add_fields($test_fields);
// Added to the 'layouts' key
$config['layouts']['test'] = $test_layout;
// Fuel layout block
$image_right = new Fuel_block_layout('image_right');
$image_right->set_label('Image Right');
$image_right->add_field('title', array());
$image_right->add_field('content', array('type' =>'text'));
$image_right->add_field('image', array('type' =>'asset'));
// NOTE THIS IS ADDED TO THE 'blocks' key and not the 'layouts' key !!!!
$config['blocks']['image_right'] = $image_right;
Comments
You should be able to see the blocks layouts when creating a page in the CMS with the layout of "test". There should be a dropdown displayed in the Layout Variables area with all the specified block layouts from the _blocks/sections folder.
2 small questions:
1) How can I do inline edit a block (I tried with fuel_var but not fuction for array record in db)
2) Why $ image_right-> set_label ('Right Image'), not fuction in this sample. I always come out in the select image_right
Thanks always, I find this amazing system unfortunately there is a guide in Italian.
The set label doesn't quite work well with block layouts because of how the options list is rendered if no options are passed to it. It uses the fuel_blocks_model::options_list_with_views() method which scans the directory to determine the label instead. As an alternative, you can set your own "options" parameter which should be a key/value array with the key being the name of the block and the value being the label to display in the dropdown select.