Skip to content
Snippets Groups Projects
Commit c4c93935 authored by Marcus Johansson's avatar Marcus Johansson
Browse files

Issue #3447795 by Marcus_Johansson: The directory needs to be prepared in the filehlper

parent aef9289c
No related branches found
No related tags found
No related merge requests found
Pipeline #174951 failed
<?php
namespace Drupal\ai_interpolator\Plugin\AiEvaluationTool;
use Drupal\ai_evaluation\PluginInterface\AiToolPluginInterface;
use Drupal\ai_evaluation\Attribute\AiTool;
use Drupal\Core\StringTranslation\TranslatableMarkup;
#[AiTool(
id: 'ai_interpolator_tool',
label: new TranslatableMarkup('AI Interpolator'),
description: new TranslatableMarkup('Use the AI Interpolator to compare workflows.'),
)]
class AiInterpolatorTool implements AiToolPluginInterface {
}
......@@ -86,7 +86,9 @@ class FileHelper {
*/
public function createFilePathFromFieldConfig($fileName, FieldDefinitionInterface $fieldDefinition, ContentEntityInterface $entity) {
$config = $fieldDefinition->getConfig($entity->bundle())->getSettings();
return $this->token->replace($config['uri_scheme'] . '://' . rtrim($config['file_directory'], '/')) . '/' . $fileName;
$path = $this->token->replace($config['uri_scheme'] . '://' . rtrim($config['file_directory'], '/'));
$this->fileSystem->prepareDirectory($path);
return $path . '/' . $fileName;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment