表达式引擎:安装模块时创建多个发布表单选项卡

时间:2012-11-01 15:49:47

标签: expressionengine

是否可以创建一个模块,在发布屏幕中输出两个选项卡,或者我是否有两个创建另一个模块来创建我的第二个选项卡或只是另一个tab.file.php文件?

CODE

文件: 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;   
    }

}

文件: 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;
    }
 }

在My_module_upd-> tabs()方法中,它似乎可以在数组中声明多个选项卡,但My_module_tab类似乎只能控制一个选项卡。有人能指出我正确的方向吗?

0 个答案:

没有答案