Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ExtensionPathResolver.php

function ExtensionPathResolver::getPathname

Gets the info file path for the extension.

Parameters

string $type: The extension type.

string $name: The extension name.

Return value

string|null The extension path, or NULL if unknown.

1 call to ExtensionPathResolver::getPathname()
ExtensionPathResolver::getPath in core/lib/Drupal/Core/Extension/ExtensionPathResolver.php
Gets the extension directory path.

File

core/lib/Drupal/Core/Extension/ExtensionPathResolver.php, line 50

Class

ExtensionPathResolver
Factory for getting extension lists by type.

Namespace

Drupal\Core\Extension

Code

public function getPathname(string $type, string $name) : ?string {
    if ($type === 'core') {
        return 'core/core.info.yml';
    }
    if (!isset($this->extensionLists[$type])) {
        throw new UnknownExtensionTypeException(sprintf('Extension type %s is unknown.', $type));
    }
    try {
        return $this->extensionLists[$type]
            ->getPathname($name);
    } catch (UnknownExtensionException) {
        // Catch the exception. This will result in triggering an error.
        // If the filename is still unknown, create a user-level error message.
        trigger_error(sprintf('The following %s is missing from the file system: %s', $type, $name), E_USER_WARNING);
        return NULL;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal