/** * @inheritdoc */ public function getSitePath($location, $resource, ModuleInterface $module = null) { // Ensure the passed-in resource has no leading slashes and no surrounding whitespace $resource = ltrim(trim($resource), '/'); switch ($location) { case ResourceLocations::RESOURCE_LOCATION_SITE: // For the site level, the module name must be inserted $root = $this->getSiteRoot(); $resource = sprintf('%s/%s', NameUtilities::convertToDashedLower($this->engine->getModuleName($module)), $resource); break; case ResourceLocations::RESOURCE_LOCATION_VENDOR: throw new \InvalidArgumentException('The "vendor" location identifier cannot be used for site paths'); case ResourceLocations::RESOURCE_LOCATION_MODULE: $root = sprintf('%s/%s', $module->getModuleRoot(), ResourceLocations::RESOURCES_DIRECTORY); break; case ResourceLocations::RESOURCE_LOCATION_ENGINE: $root = sprintf('%s/%s', $this->engine->getEngineRoot(), ResourceLocations::RESOURCES_DIRECTORY); break; default: throw new \InvalidArgumentException(sprintf('Cannot find site resource in unknown location "%s"', $location)); } return sprintf('%s/site/%s', $root, $resource); }