how can I override action=index?

I already tried adding this to a custom controller:


function action_index(){
        //$this->view = '<action lowercase>';
        echo "test";
        die;
}

But it didn’t help much. Is this possible as I want to have a different default page when the module is opened?

That function is the only content of my custom controller at the moment.

Thank you

1 Like

I don’t really know the answer, but I suspect you shouldn’t be trying this in the first place :slight_smile:

What are you trying to achieve with this? Why not just customize the existing views?

I wanted to override the view for index. But it seems like I can just do it by adding view.lists.php :slight_smile:

Can you direct me to an example on how to create a custom view.list.php if there is no views in the main module?

Sorry, I can’t… this is all unexplored territory to me… :frowning:

I managed to make it work I just created a custom list view and have it point to a different tpl file. :slight_smile:

I’ve been working on figuring this out.
It doesn’t look as if suite pays any attention to a controllers action_index method.

You’ll find this in SugarController.php:

        // index actions actually maps to the view.list.php view
        if ($action == 'index') {
            $action = 'list';
        }

Also, search the code for action_remap and remap_action to see a similar mechanism.

I now understand the controller a lot better than I did in 2018. It’s not that complicated, but it does involve two or three different ways of calling things (like “very legacy”, “legacy”, “not so legacy” :slight_smile: )

I still doubt that this is a good solution for anything, but you can prove me wrong by explaining your use-case…