We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Multiple Tab Module

Development and Programming

aa146214's avatar
aa146214
2 posts
13 years ago
aa146214's avatar aa146214

Is it possible to create a module that outputs two tabs into a channel or do I have two create another module to to create my second tab or just another tab.file.php file?

CODE

FILE: upd.my_module.php

class My_module_upd {
    var $version = '1.0';

    public function __construct(){
        $this->EE =& get_instance();
    }

    public function install(){
    $this->EE->load->dbforge();

    $data = array(
            'module_name' => 'My Module',
            'module_version' => $this->version,
            'has_cp_backend' => 'y',
            'has_publish_fields' => 'y'
    );

    $this->EE->db->insert('modules', $data);
    return true;
    }

    public function tabs(){
    $tabs['tab_1'] = array(
        'field_1'   => array(
                            'visible'       => TRUE,
                            'collapse'      => FALSE,
                            'htmlbuttons'   => TRUE,
                            'width'         => '100%'
                            ),

        'field_2'       => array(
                            'visible'       => TRUE,
                            'collapse'      => FALSE,
                            'htmlbuttons'   => TRUE,
                            'width'         => '100%'
                            )
            );

    $tabs['tab_2'] = array(
            'field_1'   => array(
                    'visible'       => TRUE,
                    'collapse'      => FALSE,
                    'htmlbuttons'   => TRUE,
                    'width'         => '100%'
                ),
            );

    return $tabs;   
    }
}

FILE: tab.my_module.php

class My_module_tab {
public function __construct(){
    $this->EE =& get_instance();
}

public function publish_tabs($channel_id, $entry_id = ''){
    $settings = array(
            'field_1' => array(
                    'field_id'              => 'field_1',
                    'field_label'           => 'Field 1',
                    'field_type'            => 'text',
                    'field_required'        => 'n',
                    'field_data'            => '',
                    'field_text_direction'  => 'ltr',
                    'field_maxl'            => 100,
                    'field_instructions'    => '',
            ),
            'field_2'   => array(
                    'field_id'              => 'field_2',
                    'field_label'           => 'Field 2',
                    'field_type'            => 'text',
                    'field_required'        => 'n',
                    'field_data'            => '',
                    'field_text_direction'  => 'ltr',
                    'field_maxl'            => 100,
                    'field_instructions'    => '',
            ),
    );

    return $settings;
    }
 }

It looks like 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?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.