I want to set my site logo programmatically, so that I can change the logo based on URL args.
I am able to set the $variables['logo_img']['#uri']
with the following code in MYTHEME.theme but still the logo displayed does not change.
I have cleared registry.
I have tried setting my own logo and using default logo settings in theme settings UI:
function THEME_preprocess_page(&$variables) {
$variables['logo_img']['#uri'] = 'http://newlogo.jpg'; }
I have also tried this:
function THEME_preprocess_page(&$variables) {
global $base_url, $base_path;
$variables['logo'] = $base_url . $base_path . drupal_get_path('theme','THEME') . '/images/logos/newlogo.svg';
}
Any help?