On this page
Caution
The documentation you are viewing is for an older version of this component.
Switch to the latest (v3) version.
Elements
Image
Laminas\Form\Element\Image
represents a image button form input.
It can be used with the FormImage view helper.
Basic Usage
This element automatically adds a type
attribute of value image
.
use Laminas\Form\Element;
use Laminas\Form\Form;
$image = new Element\Image('my-image');
$image->setAttribute('src', 'http://my.image.url'); // Src attribute is required
$form = new Form('my-form');
$form->add($image);