Commit 61b2dcab authored by Nicolas Widart's avatar Nicolas Widart

Register the asset view composer dynamically in the blade directives.

Allows to bind the media assets on custom views too.
parent 93838b76
......@@ -2,6 +2,8 @@
namespace Modules\Media\Blade;
use Modules\Media\Composers\Backend\PartialAssetComposer;
class MediaMultipleDirective
{
/**
......@@ -22,6 +24,8 @@ class MediaMultipleDirective
$this->extractArguments($arguments);
$view = $this->view ?: 'media::admin.fields.new-file-link-multiple';
view()->composer($view, PartialAssetComposer::class);
$zone = $this->zone;
if ($this->entity !== null) {
......
......@@ -2,6 +2,8 @@
namespace Modules\Media\Blade;
use Modules\Media\Composers\Backend\PartialAssetComposer;
class MediaSingleDirective
{
/**
......@@ -22,6 +24,8 @@ class MediaSingleDirective
$this->extractArguments($arguments);
$view = $this->view ?: 'media::admin.fields.new-file-link-single';
view()->composer($view, PartialAssetComposer::class);
$zone = $this->zone;
if ($this->entity !== null) {
......
<?php
view()->composer(['media::admin.fields.new-*'], 'Modules\Media\Composers\Backend\PartialAssetComposer');
......@@ -20,6 +20,5 @@
"MediaMultipleDirective": "Modules\\Media\\Blade\\Facades\\MediaMultipleDirective"
},
"files": [
"composers.php"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment