We built a drupal theme "Theme A" from scratch for our project. Later , for the new releases , we wanted to modify the newly developed pages which were slightly enhanced versions of previous pages. In order to retain most of the css and js , we created a sub theme "Theme B" from "Theme A" . Now most of the images which we had used earlier are in Theme A's image folder. How do we reuse Theme A's images in Theme B without copying them ? The current default theme is set to "Theme B".

We used base_path().path_to_theme() to refer images. I guess we must now change it to drupal_get_path('theme','themeA').

  • From css and js files, you just call relative paths like so: background-image: url(../../theme_a/images/my-image.jpg); From php files, you can call the drupal_get_path() function like so: $themeAPath = drupal_get_path('theme', 'theme_a'); – hachesilva Aug 25 '14 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.