Hi,
I have created a layout template as follows:
$homepage_layout->add_field('Homepage_content', array('type' => 'fieldset', 'label' => 'Hompage Message', 'class' => 'tab'));
$homepage_layout->add_field('homepage_content', array('display_label' => FALSE, 'add_extra' => FALSE, 'init_display' => 'none', 'dblclick' => 'accordian', 'repeatable' => FALSE, 'style' => 'width: 900px;', 'type' => 'template', 'label' => 'Page sections', 'title_field' => 'title',
'fields' => array(
'homepage_content' => array('type' => 'section', 'label' => 'Homepage: {__title__}'),
'title' => array('style' => 'width: 800px'),
'content' => array('type' => 'textarea', 'style' => 'width: 800px; height: 500px;'),
'image' => array('type' => 'asset', 'multiple' => FALSE),
)));
I was expecting the item title bar to display the content title, however it displays "Homepage: {__title__}"
what have I missed?
Regards
David
Comments
define('FUEL_VERSION', '1.3.1');
the 'title_field' => 'title', needs to be set to the form_element name, then the element name needs to be used for the 'label' =>'{__form_element__}'.
I don't think it works for the code snippet above as it's not repeatable, like the other parts of the template I was working on. So here's a code snippet of a working section, hope it's of use to someone else.
$homepage_layout->add_field('Main_block', array('type' => 'fieldset', 'label' => 'Main blocks', 'class' => 'tab'));
$homepage_layout->add_field('main_block', array('display_label' => FALSE, 'add_extra' => FALSE, 'init_display' => 'none', 'dblclick' => 'accordian', 'repeatable' => TRUE, 'style' => 'width: 900px;', 'type' => 'template', 'label' => 'Page sections', 'title_field' => 'main_block_title',
'fields' => array(
'main_block' => array('type' => 'section', 'label' => '{__main_block_title__}'),
'main_block_title' => array('style' => 'width: 800px'),
'main_block_content' => array('type' => 'textarea', 'style' => 'width: 800px; height: 100px;'),
'main_block_image' => array('type' => 'asset', 'multiple' => FALSE),
)));