I'm using the following code to change the title of the view statuses_all

function statuscustom_views_default_views_alter(&$views) {
var_dump($views);

if (isset($views['statuses_all'])) {
$views['statuses_all']->set_display('Page');
$views['statuses_all']->display_handler->set_option('title', 'Categories2');
}
}

But it doesn't work. It does work with taxonomy_term view. I think it doesn't work with statuses_all because this is a "Database overriding code" instead of "in code".

Any ideas?

Thank you

V.

Comments

IceCreamYou’s picture

Status: Active » Fixed

I think you probably want something that looks more like

$views['statuses_all']->display['default']->display_options['title'] = t('Categories2');

although I haven't tested whether that's actually the option you want to change.

But yes, if you've modified the view on your site then you won't be able to modify it in the hook_views_default_views_alter() implementation unless you reset the view.

vanleurth’s picture

Status: Fixed » Active

That works !!
The problem I was having was due to modifying the view on my site. Once I reset (revert) the view then it worked with the code shown above by IceCreamYou.

V.

IceCreamYou’s picture

Status: Active » Fixed

Glad to hear it

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.