ThemeUpdater::getInstallDirectory

  1. drupal
    1. 8
    2. 7
Versions
7 public ThemeUpdater::getInstallDirectory()

Return the directory where a theme should be installed.

If the theme is already installed, drupal_get_path() will return a valid path and we should install it there (although we need to use an absolute path, so we prepend DRUPAL_ROOT). If we're installing a new theme, we always want it to go into sites/all/themes, since that's where all the documentation recommends users install their themes, and there's no way that can conflict on a multi-site installation, since the Update manager won't let you install a new theme if it's already found on your system, and if there was a copy in sites/all, we'd see it.

Code

modules/system/system.updater.inc, line 107

<?php
public function getInstallDirectory() {
  if ($relative_path = drupal_get_path('theme', $this->name)) {
    $relative_path = dirname($relative_path);
  }
  else {
    $relative_path = 'sites/all/themes';
  }
  return DRUPAL_ROOT . '/' . $relative_path;
}
?>