Skip to content

Commit

Permalink
Add parameter in configuration for Cloudinary folder mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy Čupić committed Sep 17, 2024
1 parent c59c202 commit 99049f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Netgen\Bundle\RemoteMediaBundle\DependencyInjection;

use Netgen\RemoteMedia\Core\Provider\Cloudinary\CloudinaryProvider;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand Down Expand Up @@ -162,6 +163,10 @@ private function addCloudinaryConfiguration(ArrayNodeDefinition $rootNode): void
->scalarNode('encryption_key')
->defaultNull()
->end()
->enumNode('folder_mode')
->values([CloudinaryProvider::FOLDER_MODE_DYNAMIC, CloudinaryProvider::FOLDER_MODE_FIXED])
->defaultValue(CloudinaryProvider::FOLDER_MODE_DYNAMIC)
->end()
->end()
->end()
->end();
Expand Down
5 changes: 5 additions & 0 deletions bundle/DependencyInjection/NetgenRemoteMediaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public function load(array $configs, ContainerBuilder $container): void

$container->setAlias('netgen_remote_media.provider.cloudinary.gateway', $cloudinaryGatewayAlias);

$container->setParameter(
'netgen_remote_media.cloudinary.folder_mode',
$config['cloudinary']['folder_mode'],
);

$loader->load('default_parameters.yaml');
$loader->load('services/**/*.yaml', 'glob');
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Core/Provider/Cloudinary/CloudinaryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@

final class CloudinaryProvider extends AbstractProvider
{
public const FOLDER_MODE_FIXED = 'fixed';

public const FOLDER_MODE_DYNAMIC = 'dynamic';

private const IDENTIFIER = 'cloudinary';

public function __construct(
Expand Down

0 comments on commit 99049f5

Please sign in to comment.