Layout with block

edited March 2014 in Feature Requests
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

  • edited 9:53PM
    I'm not quite sure I understand this "after the creation of the various blocks occur after saved you can not make more edits."

    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.
  • edited 9:53PM
    The creation of the page with several blocks working properly, but if I want to update the page content blocks are no longer visible in admin panel.
  • edited 9:53PM
    Where in the admin panel are they not visible (what's the URI path)?
  • edited 9:53PM
    Thanks for everything, I solved the problem, there was probably some error in the initial ftp.
    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.
  • edited 9:53PM
    To make a block inline editable, it must be saved in the CMS. Using the fuel_block function by default will give it a pencil icon (it has an "editable" parameter set to TRUE by default when stored in the CMS).

    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.
Sign In or Register to comment.