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

Breadcrumb

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

function ComponentPluginManager::findAsset

Finds assets related to the provided metadata file.

Parameters

string $component_directory: The component directory for the plugin.

string $machine_name: The component's machine name.

string $file_extension: The file extension to detect.

bool $make_relative: TRUE to make the filename relative to the core folder.

Return value

string|null Filenames, maybe relative to the core folder.

2 calls to ComponentPluginManager::findAsset()
ComponentPluginManager::alterDefinition in core/lib/Drupal/Core/Theme/ComponentPluginManager.php
Alters the plugin definition with computed properties.
ComponentPluginManager::libraryFromDefinition in core/lib/Drupal/Core/Theme/ComponentPluginManager.php
Creates the library declaration array from a component definition.

File

core/lib/Drupal/Core/Theme/ComponentPluginManager.php, line 442

Class

ComponentPluginManager
Defines a plugin manager to deal with components.

Namespace

Drupal\Core\Theme

Code

private function findAsset(string $component_directory, string $machine_name, string $file_extension, bool $make_relative = FALSE) : ?string {
    $absolute_path = sprintf('%s%s%s.%s', $component_directory, DIRECTORY_SEPARATOR, $machine_name, $file_extension);
    if (!file_exists($absolute_path)) {
        return NULL;
    }
    return $make_relative ? $this->makePathRelativeToLibraryRoot($absolute_path) : $absolute_path;
}

API Navigation

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