* __('Programme')
* __('Documentation')
*/
- $typedocs = ['odt', 'doc', 'docx', 'pdf'];
+
+ $forceDownload = ['software', 'cad'];
$res = [];
foreach ($this->_documents as $fieldName => $label) {
foreach ($this->getMediaInField($this->$fieldName) as $media) {
/** @var $media Media */
$e = explode('/', $media->getUrl());
$fname = array_pop($e);
- $res[] = ['media' => $media, 'label' => $media->getCustomProperty('alt') ?: $fname, 'tooltip' => __($label), 'type' => $fieldName];
+ $res[] = ['media' => $media, 'label' => $media->getCustomProperty('alt') ?: $fname, 'tooltip' => __($label), 'type' => $fieldName, 'forceDownload' => in_array($fieldName, $forceDownload)?$fname:false];
}
}
<ul>
@foreach($product->getEntity()->getDocuments() as $document)
<li>
- <a href="{{ $document['media']->getUrl() }}" target="_blank"
+ <a href="{{ $document['media']->getUrl() }}"
+ @if($document['forceDownload'])
+ download="{{$document['forceDownload']}}"
+ @else
+ target="_blank"
+ @endif
data-tooltip="{{$document['tooltip']}}"
class="inline-flex items-center text-grey-dark hover:text-primary">
<img class="mr-4 mb-2"