Allows to pass more options to attachment component
This commit is contained in:
parent
1a4c959edd
commit
d02e0a8602
|
@ -174,7 +174,7 @@ public function replaceAttachmentsInMarkdown(string $markdown)
|
||||||
/**
|
/**
|
||||||
* Return a Blade component for the attachment we passed the ref off
|
* Return a Blade component for the attachment we passed the ref off
|
||||||
*/
|
*/
|
||||||
public function getComponentByRef(string $ref, ?string $filter = null)
|
public function getComponentByRef(string $ref, ?string $filter, ?array $options = [])
|
||||||
{
|
{
|
||||||
$attachment = $this->getAttachmentData($ref);
|
$attachment = $this->getAttachmentData($ref);
|
||||||
$variant = null;
|
$variant = null;
|
||||||
|
@ -191,7 +191,7 @@ public function getComponentByRef(string $ref, ?string $filter = null)
|
||||||
$variant['filename'] = $this->getVariantFullPath($ref, $filter);
|
$variant['filename'] = $this->getVariantFullPath($ref, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$component = $this->getBladeComponent($attachment, $variant);
|
$component = $this->getBladeComponent($attachment, $variant, $options);
|
||||||
|
|
||||||
return $component;
|
return $component;
|
||||||
}
|
}
|
||||||
|
@ -343,11 +343,11 @@ private function getFormatedFilename(string $path): string
|
||||||
* Return a Blade component corresponding to the kind of data we are
|
* Return a Blade component corresponding to the kind of data we are
|
||||||
* managing, and we pass it attachment data
|
* managing, and we pass it attachment data
|
||||||
*/
|
*/
|
||||||
private function getBladeComponent(array $data, ?array $variant = [])
|
private function getBladeComponent(array $data, ?array $variant, ?array $options = [])
|
||||||
{
|
{
|
||||||
switch ($this->kind) {
|
switch ($this->kind) {
|
||||||
case self::Images:
|
case self::Images:
|
||||||
return new Image($data, $variant);
|
return new Image($data, $variant, $options);
|
||||||
case self::Sounds:
|
case self::Sounds:
|
||||||
return new Sound($data);
|
return new Sound($data);
|
||||||
case self::Videos:
|
case self::Videos:
|
||||||
|
|
|
@ -15,7 +15,7 @@ abstract class BaseMediaComponent extends Component
|
||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(protected array $data, protected ?array $variant = [])
|
public function __construct(protected array $data, protected ?array $variant = [], protected ?array $options = [])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ public function render(): View|Closure|string
|
||||||
'variantUrl' => $variantUrl,
|
'variantUrl' => $variantUrl,
|
||||||
'originalData' => $this->data,
|
'originalData' => $this->data,
|
||||||
'variantData' => $this->variant,
|
'variantData' => $this->variant,
|
||||||
|
'options' => $this->options,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user