Note that there are some explanatory texts on larger screens.

plurals
  1. POExpression Engine: Create multiple publish form tabs when installing a module
    text
    copied!<p>Is it possible to create a module that outputs two tabs into the publish screen, or do I have two create another module to to create my second tab or just another tab.file.php file?</p> <p><strong>CODE</strong></p> <p><strong>FILE:</strong> upd.my_module.php</p> <pre><code>class My_module_upd { var $version = '1.0'; public function __construct(){ $this-&gt;EE =&amp; get_instance(); } public function install(){ $this-&gt;EE-&gt;load-&gt;dbforge(); $data = array( 'module_name' =&gt; 'My Module', 'module_version' =&gt; $this-&gt;version, 'has_cp_backend' =&gt; 'y', 'has_publish_fields' =&gt; 'y' ); $this-&gt;EE-&gt;db-&gt;insert('modules', $data); return true; } public function tabs(){ $tabs['tab_1'] = array( 'field_1' =&gt; array( 'visible' =&gt; TRUE, 'collapse' =&gt; FALSE, 'htmlbuttons' =&gt; TRUE, 'width' =&gt; '100%' ), 'field_2' =&gt; array( 'visible' =&gt; TRUE, 'collapse' =&gt; FALSE, 'htmlbuttons' =&gt; TRUE, 'width' =&gt; '100%' ) ); $tabs['tab_2'] = array( 'field_1' =&gt; array( 'visible' =&gt; TRUE, 'collapse' =&gt; FALSE, 'htmlbuttons' =&gt; TRUE, 'width' =&gt; '100%' ), ); return $tabs; } </code></pre> <p>}</p> <p><strong>FILE:</strong> tab.my_module.php</p> <pre><code>class My_module_tab { public function __construct(){ $this-&gt;EE =&amp; get_instance(); } public function publish_tabs($channel_id, $entry_id = ''){ $settings = array( 'field_1' =&gt; array( 'field_id' =&gt; 'field_1', 'field_label' =&gt; 'Field 1', 'field_type' =&gt; 'text', 'field_required' =&gt; 'n', 'field_data' =&gt; '', 'field_text_direction' =&gt; 'ltr', 'field_maxl' =&gt; 100, 'field_instructions' =&gt; '', ), 'field_2' =&gt; array( 'field_id' =&gt; 'field_2', 'field_label' =&gt; 'Field 2', 'field_type' =&gt; 'text', 'field_required' =&gt; 'n', 'field_data' =&gt; '', 'field_text_direction' =&gt; 'ltr', 'field_maxl' =&gt; 100, 'field_instructions' =&gt; '', ), ); return $settings; } } </code></pre> <p>In the My_module_upd->tabs() method it looks like to can declare multiple tabs in the array but the My_module_tab class seems geared to controlling just one tab. Can anyone point me in the right direction?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload