$dataTable .= '<td>';
$images = $product->imagesWriteOffsErp;
if (!empty($images)) {
- $forWidget = true; // или false в зависимости от вашей логики
- if ($forWidget) {
- $dataTable .= '<div class="gallery-container">';
- $dataTable .= dosamigos\gallery\Gallery::widget([
- 'items' => WriteOffsErp::getImagesList($images, $forWidget)
- ]);
- $dataTable .= '</div>';
- } else {
- foreach ($images as $image) {
- $dataTable .= Html::img($image->url, ['style' => 'max-width: 100px; margin: 5px;']);
- }
+ $dataTable .= '<div style="display: flex; flex-wrap: wrap; gap: 5px;">';
+ foreach ($images as $image) {
+ $dataTable .= Html::a(
+ Html::img($image->url, ['style' => 'max-width: 100px; max-height: 100px;']),
+ $image->url,
+ [
+ 'data-fancybox' => 'gallery',
+ 'data-caption' => $product->name
+ ]
+ );
}
+ $dataTable .= '</div>';
}
$dataTable .= '</td>';