Using ImageOutput ViewModel

The Loki\Field\ViewModel\ImageOutput class allows for outputting images and icons easily in your own PHTML template. This page describes the basic usage.

use Loki\Components\Factory\ViewModelFactory;
use Loki\Field\ViewModel\ImageOutput;

/** @var ViewModelFactory $viewModelFactory */
/** @var ImageOutput $imageOutput */

$imageOutput = $viewModelFactory->create(ImageOutput::class);
?>

<div>
    <?= /* @noEscape */ $imageOutput->get('Loki_FieldComponents::images/spinner.svg') ?>
</div>
Last modified: August 1, 2025