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.

Adding Block's to Custom Module.

edited October 2017 in Modules
I have created a module and added a block to one of the field like below .

$fields = parent::form_fields($values, $related);
$fields['block'] = array('type' => 'block', 'folder' => 'sections');

And also made that field as serialize to save array as a string in DB as we do it in Pages Variable.

Issue is whenever , on saving the form from Admin UI its updated in DB but on clicking edit,
Block fields are not populated


  • edited October 2017
    For the block layouts, you'll need to set the model property to be your module's model. By default, it will pull values from the Fuel_pagevariables_model.
  • edited 10:25AM
    Thanks for the quick reply. It's working now !!!

    now my block layout look's like in C:\xampp\htdocs\fuel_cms\fuel\application\config\MY_fuel_layouts.php

    $posts_img = new Fuel_block_layout('posts_img');
    $posts_img->set_label('Posts Images');
    $posts_img->add_field('title', array());
    $posts_img->add_field('content', array('type' =>'text'));
    $posts_img->add_field('image', array('type' =>'asset'));
    $posts_img->set_model('Journals_model'); // NOTE THIS IS ADDED TO THE 'blocks' key and not the 'layouts' key !!!! $config['blocks']['posts_img'] = $posts_img;
Sign In or Register to comment.