Remove mass assign form from custom view

Hello you all, hope you are having a great day. I’m having some trouble trying to create a custom view for a module, so I’m going to try explaining whats’a my problem here.

What I want is overriding the default view (index/ListView) for a custom module with my own custom view. What I’ve already done is the next:

  • I have a remap from action index to my custom action custom/Extension/modules/<custom_module>/Ext/ActionReMap/remap_default_view.php like this:
$action_remap['index'] = 'filter';
  • Then I’ve binded the action to a view in custom/Extension/modules/<custom_module>/Ext/ActionViewMap/custom_view.php:
$action_view_map['filter'] = 'filter';

Then I’ve created the view controller in custom/modules/<custom_modules>/views/view.filter.php. Then I’ve created a tpl file which I’m loading a tpl in the display function like this:

    public function display() {
        parent::display();
        $this->ss->display('custom/modules/CustomModule/tpls/filter.tpl');
    }

As you can see the tpl is being loaded great, but the mass assign form from the ListView is being loaded under my custom view. It seems like the CRM has some kind of check to see if the action=index to load this form.
Also if I modify the URL and set manually action=filter this form disappears.

Is there any way to remove this mass assign form for this view without having to redirect to the custom action? (action=index but without the mass assign form)

My suitecrm version is 7.13.0.

If there’s something I didn’t explained well feel free to ask.
Thanks for your time!!

@Pablonr

Try to use index.php in custom module.

I’ve tried using an index.php but with this solution I can’t make use of the view.filter.php and SugarView functions.

From what I’ve seen the CRM has logic_hooks in custom/modules/logic_hooks.php:

$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); 

I’ve analyzed this logic hooks, and there’s where the crm checks if the current action == ‘index’. Also has other conditions:

if (isset($module) && ($action == "list" || $action == "index" || $action == "listview")
        && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != true)
        && !array_key_exists($module, $no_mass_assign_list)
        ) {
              // does something / loads the form
          }

What I did is setting the $_REQUEST[‘search_form_only’] to true in the __construct() function in view.filter.php. I don’t think is the more ‘elegant’ solution but it did the work for me.

    public function __construct()
    {
        $_REQUEST['search_form_only'] = true; // Hack to hide Security Groups mass assign form.
    }

If there’s any solution that’s better I would like to know how it should be done.

Also thanks for your answer.

Why?

Look at the module Calendar and file:
modules/Calendar/index.php