Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Make Sections Inline Editable in Block Layouts

edited October 2014 in Feature Requests
Hi everybody. Beginner in Fuel CMS, first: congrats for that seems a very flexible and smart project, and second : sorry for my terrible english.
Cheers from Nice in France ! :)

I've tried this example of Block Layouts
http://docs.getfuelcms.com/general/layouts#layouts_block_layouts
Work Fine and i'm enthousiastic about this feature, i'm just asking if it's possible to have the differents fields inline editing (actually i have the pencil enable on the page but not on this sections, i can of course add/update/order etc in the backOffice )
Inline editing will be amazing for my final users,

Have read differents topics about Block Layouts but perhaps i'm too noob to see the answer.

Thx for any help about that, and sure i've don't finish to bother you :)

Comments

  • edited 1:17AM
    Inline editing for block fields will display all the fields associated with the layout when editing inline (not just one field at a time). If you say have a page layout variable that is of type "block" named "section", you can use either of the following:
    // This will output the variable and add the pencil icon for inline editing <?=fuel_var('section')?> // OR this will just output the pencil icon for inline editing <?=fuel_edit('section')?>
  • edited October 2014
    Hi, thx for your answer.

    i've reproduce the example of the documentation about Block Layouts, so i have in
    fuel/application/config/MY_fuel_layouts.php

    // 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;


    And in
    fuel/application/views/_layouts/test.php

    <?=fuel_var('h1', ''); ?>

    <?php foreach($sections as $section) :
    // 'block_name' contains the hidden field value that automatically set to the name of the selected block
    $block_name = $section['block']['block_name'];
    if (!empty($block_name)) :
    ?>
    <?=fuel_block('sections/'.$block_name, $section['block']) ?>
    <?php endif; ?>
    <?php endforeach; ?>
    etc .... just like documentation

    what i was calling sections in my answer was more about editing online the block fields that are in the example a Title, a content wysiwyg , and an image
    and i don't see where put <?=fuel_var('section')?> in this particular case
  • edited 1:17AM
    In this case, since $sections is actually the field input, you would need to add an echo fuel_edit('sections') like the following:
    <?=fuel_var('h1', ''); ?> <?php echo fuel_edit('sections');?> <?php foreach($sections as $section) : // 'block_name' contains the hidden field value that automatically set to the name of the selected block $block_name = $section['block']['block_name']; if (!empty($block_name)) : ?> <?=fuel_block('sections/'.$block_name, $section['block']) ?> <?php endif; ?> <?php endforeach; ?>

    Unfortunately, there isn't a way to do inline editing with say a single section. It's treated just as it would be in the CMS so all sections will be displayed.
  • edited 1:17AM
    ok i see, but inconvenience is minor and your answer it's just great and i see a lot of case where he can be useful.
    Thx a lot, have nice day
Sign In or Register to comment.