protected function ConfigActionsFile::filePath in Config Actions 8
Return the file name and path from the source specifier
Parameters
$source:
string $base: Optional base path
Return value
array 0 - file name 1 - file path
2 calls to ConfigActionsFile::filePath()
- ConfigActionsFile::doLoad in src/
Plugin/ ConfigActionsSource/ ConfigActionsFile.php - Load data from the source.
- ConfigActionsFile::doSave in src/
Plugin/ ConfigActionsSource/ ConfigActionsFile.php - Save data to the source.
File
- src/
Plugin/ ConfigActionsSource/ ConfigActionsFile.php, line 94
Class
- ConfigActionsFile
- Plugin for config source from files.
Namespace
Drupal\config_actions\Plugin\ConfigActionsSourceCode
protected function filePath($source, $base = '') {
$filepath = $this->fileSystem
->dirname($source);
$filename = $this->fileSystem
->basename($source, '.' . FileStorage::getFileExtension());
// See if Source specifies its own path or not.
if (empty($filepath) || $filepath == '.') {
// Path not specified, so use provided base or current directory.
$base = !empty($base) ? $base : dirname(__FILE__);
$filepath = $base . '/' . self::CONFIG_TEMPLATE_DIRECTORY;
}
elseif (!empty($base)) {
// If path was specified in Source, prepend any provided base path.
$filepath = $base . '/' . $filepath;
}
return [
$filepath,
$filename,
];
}