It looks like you're new here. If you want to get involved, click one of these buttons!
public $serialized_fields = array('make_hub_page');
public function form_fields($values = array(), $related = array()) {
...
$fields['Hub'] = array('type' => 'fieldset', 'label' => 'Hub Page', 'order' => 200, 'class' => 'tab');
$fields['make_hub_page'] = array(
'display_label' => FALSE,
'type' => 'template',
'init_display' => 'first',
'dblclick' => 'toggle',
'order' => 210,
'label' => 'Page sections',
'fields' => array('block' => array('type' => 'block', 'folder' => 'manufacturer_landing'),),
'add_extra' => FALSE,
'repeatable' => TRUE,
);
....
}
[{"block":{"title":"test title","content":"test content","tips":"test tips","no_results_message":"no results","images":[{"title":"","image":""}],"block_name":"main_search"}},{"block":{"header_text":"test header","text":"test text","disclosure_text":"test disclosure text","block_name":"manufacturer_finance"}}]
Comments
the layout looks like this :
$man_landing_layout = new Fuel_layout('manufacturer_landing'); $man_landing_layout->set_description('This layout is for the New cars.'); $man_landing_layout->set_label('Manufacturer Landing Page'); $CI->load->model("Cap_range_model"); $CI->load->model("Cap_model_model"); $man_layout_fields = array( 'Sections' => array('type' => 'fieldset', 'label' => 'Sections', 'class' => 'tab'), 'sections' => array( 'type' => 'template', 'display_label' => FALSE, 'label' => 'Sections', 'add_extra' => FALSE, 'repeatable' => TRUE, 'max' => 12, 'min' => 0, 'title_field' => 'block', 'fields' => array( 'section' => array('type' => 'section', 'value' => 'Section <span class="num">{num}</span>'), 'block' => array('type' => 'block', 'folder' => 'manufacturer_landing'), ), ), 'body_class' => array(), ); $man_landing_layout->add_fields($common_meta); $franchise_name = array( 'franchise_name' => array('type' => 'select2', 'required' => TRUE, 'options' => $franchise_manufacturer_list) ); $man_landing_layout->add_fields($franchise_name); $man_landing_layout->add_fields($man_layout_fields); $config['layouts']['manufacturer_landing'] = $man_landing_layout;
and this is one of the blocks:
<div class="branch-block-container"> <div class="branch-block-overlay"> <div class="branch-block-inner"> <i class="fa fa-map-marker"></i> <h1><?= $title ?></h1> <p><?= $content ?></p> <form id="homepage-postcode-search" action="<?= site_url(); ?>dealerships/filtered" method="get" > <input type="text" name="dealership-filter-postcode" value="" id="dealership-filter-postcode" placeholder="Your Postcode..."> <input type="hidden" name="dealership-filter-manufacturer" value="<?= $franchise_name ?>"> <input type="button" name="" value="Go" id="homepage-postcode-search-button" class="green-cta"> </form> </div> </div> <div class="branch-block" id="map" style="width: 100%; height: 100%;"> </div> </div>
I don't explicitly have block layouts, where would I put them? the CMs is loading the blocks ok, it's just not putting the data in the fields to edit.
Cheers
$fields['make_hub_page'] = array( 'type' => 'template', 'display_label' => FALSE, 'label' => 'Page sections', 'add_extra' => FALSE, 'repeatable' => TRUE, 'title_field' => "block", 'init_display' => 'first', 'dblclick' => 'toggle', 'order' => 210, 'fields' => array( 'section' => array('type' => 'section', 'value' => 'Section <span class="num">{num}</span>'), 'block' => array('type' => 'block', 'block_name' => 'branch'), ), );
and it loads the data, but I now can't select other block types. is it possible to load multiple block_name's. tried an array but it falls over
http://docs.getfuelcms.com/general/layouts#layouts_block_layouts
$branch_block = new fuel_block_layout('branch'); $branch_block->set_label('Branch block test'); $branch_block->add_field('title', array()); $branch_block->add_field('content', array('type' =>'text')); $config['blocks']['branch'] = $branch_block;
$branch_block->set_model('my_model');
Cheers
David