Select field allowHtml does not render <img> tags.
I have a select field which i want to render images and descriptions, so I have to use custom html, but img tags are not rendered.
The field:
Forms\Components\Select::make('product')->options(array_map(function($product){
return $this->productToHtml($product);
}, $products))->allowHtml()
and the helper function:
public function productToHtml($product){
return '<img src="' . $product['imageUrls'][0] . '" alt="No image" ></img>' .
$product["name"] ;
}
(images are from external sources)
This code renders only the product names.
Edit: I checked it and all html classes are removed from the rendered code.
1 Reply
Solution
This only works if ->native(false) is set, but this is not documented.