default file image
This commit is contained in:
parent
7b7fa6c51d
commit
86b5476998
@ -71,7 +71,6 @@ class FieldsValueNew extends \yii\db\ActiveRecord
|
|||||||
return $this->hasOne(AdditionalFields::class, ['id' => 'field_id']);
|
return $this->hasOne(AdditionalFields::class, ['id' => 'field_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get value for view
|
* get value for view
|
||||||
* @return string
|
* @return string
|
||||||
@ -94,7 +93,9 @@ class FieldsValueNew extends \yii\db\ActiveRecord
|
|||||||
$downloadLinkHTML = ' (' . Html::a('Скачать', $this->value, ['target' => '_blank', 'download' => $filename]) . ')';
|
$downloadLinkHTML = ' (' . Html::a('Скачать', $this->value, ['target' => '_blank', 'download' => $filename]) . ')';
|
||||||
$result = $imageHTML . $downloadLinkHTML;
|
$result = $imageHTML . $downloadLinkHTML;
|
||||||
} else {
|
} else {
|
||||||
$result = $filename . ' (' . Html::a('Скачать', $this->value, ['target' => '_blank', 'download' => $filename]) . ')';
|
$imageHTML = Html::img('/media/file.png', ['width' => '100px', 'alt' => $filename]);
|
||||||
|
$downloadLinkHTML = ' (' . Html::a('Скачать', $this->value, ['target' => '_blank', 'download' => $filename]) . ')';;
|
||||||
|
$result = $imageHTML . $filename . $downloadLinkHTML;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -137,7 +138,7 @@ class FieldsValueNew extends \yii\db\ActiveRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
$extension = explode('/', $mime)['0'];
|
$extension = explode('/', $mime)['0'];
|
||||||
if (($extension === 'image') || $extension === 'application') {
|
if ($extension === 'image') {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
BIN
frontend/web/media/file.png
Normal file
BIN
frontend/web/media/file.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue
Block a user