Since I have several images I can render the images like this:
$rednered_image = [];
$rednered_image[] = [
'#theme' => 'image_style',
'#uri' => $image_uri,
'#style_name' => 'thumbnail',
];
I can pass the images to the <td>
of the table as follows:
'thread_colors' => [
'data' => [
'images' => $rednered_image,
],
],
The updated code will look like this:
$quote_printing_pms_colors = $quote_print_location->get('field_pms_colors')->getValue();
$pms_colors_name = '';
$rednered_image = [];
foreach ($quote_printing_pms_colors as $pms_color_value) {
$taxonomy_pms_color_target_id = $pms_color_value['target_id'];
$taxonomy_pms_color = $this->entityTypeManager->getStorage('taxonomy_term')->load($taxonomy_pms_color_target_id);
$taxonomy_pms_color_name = $taxonomy_pms_color->getName();
$pms_colors_name .= '<span>' . $taxonomy_pms_color_name . ' ' . '</span>';
if ($taxonomy_pms_color->get('field_image')->entity) {
$image_uri = $taxonomy_pms_color->get('field_image')->entity->getFileUri();
$rednered_image[] = [
'#theme' => 'image_style',
'#uri' => $image_uri,
'#style_name' => 'thumbnail',
];
}
}
$print_locations_rows[] = [
'thread_colors' => [
'data' => [
'images' => $rednered_image,
],
],
];
if (!empty($print_locations_rows)) {
$print_locations_header = [
'col1' => $this->t('PMS Colors'),
];
$form['confirm_quote']['designs_and_finishing_wrapper']['design_wrapper'][$key]['print_location_table'] = [
'#type' => 'table',
'#header' => $print_locations_header,
'#rows' => $print_locations_rows,
'#attributes' => [
'class' => ['my-class'],
],
];
}