function install_get_fixed_class_name
Checks a profile for install tasks.
See \Drupal\Core\Extension\Install\TasksInterface for more information.
@internal
Parameters
\Drupal\Core\Extension\Extension $extension: The extension to check install tasks for.
string $directory_search: The namespace to check.
Return value
string The tasks.
3 calls to install_get_fixed_class_name()
- install_alter_tasks in core/
includes/ install.core.inc - Checks a profile for install tasks.
- install_check_class_requirements in core/
includes/ install.inc - Checks a module or profile requirements.
- install_get_tasks in core/
includes/ install.core.inc - Checks a profile for install tasks.
File
-
core/
includes/ install.inc, line 759
Code
function install_get_fixed_class_name(Extension $extension, string $directory_search) : string {
$class_name = '';
$extension_path = $extension->getPath();
$extension_name = $extension->getName();
$dir = \Drupal::root() . "/{$extension_path}/src/{$directory_search}";
if (is_dir($dir)) {
$fileSystemIterator = new FilesystemIterator($dir);
foreach ($fileSystemIterator as $fileInfo) {
if ($fileInfo->isFile() && $fileInfo->getExtension() === 'php') {
$filename = $fileInfo->getFilename();
$extension_path = $dir . '/' . $filename;
require_once $extension_path;
$namespace = "Drupal\\{$extension_name}\\" . str_replace('/', '\\', $directory_search);
$class_name = $namespace . '\\' . $fileInfo->getBasename('.php');
}
}
}
return $class_name;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.