moduleexpressionengine

ExpressionEngine Custom Control Panel tab not working


I'm trying to add a tab to my Publish entry form, I have the following code (pruned for simplicity), but it's not working:

in tab.my_module.php:

public function display($channel_id, $entry_id = '')
{
    $settings = array();

    $settings = array(
        'custom_field' => array(
            'field_id'      => 'custom_field',
            'field_label'       => 'custom_field',
            'field_type'        => 'text'
        )
    );

    return $settings;
}

in upd.my_module.php:

public function install() {
    ee()->layout->add_layout_tabs($this->tabs(), 'my_module');
}

  public function tabs()
  {
      $tabs['my_module'] = array(
      'custom_field'=> array(
            'visible'   => 'true',
            'collapse'  => 'false',
            'htmlbuttons'   => 'true',
            'width'     => '100%'
            ),
      );

      return $tabs;
  }

But hte tab doesnt appear after i reinstall the module, what am I missing?


Solution

  • The problem was caused by having style information in the lang file!

    The new tab was actually being included on the Publish and Edit pages but the style in the Tab title was somehow causing the new tab to be hidden.

        $lang = array(
            'module_name'     => 'My Module',
            'module_description'  => 'Brief description ',
            'save_btn' => 'Save',
            'save_btn_clicked' => 'Clicked',
            'module_name' => '<style color="green">My Module</style>',
        );