Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
IceCreamYou CreditAttribution: IceCreamYou commentedI think you probably want something that looks more like
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.
Comment #2
vanleurth CreditAttribution: vanleurth commentedThat 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.
Comment #3
IceCreamYou CreditAttribution: IceCreamYou commentedGlad to hear it