protected function SiteSettingsRenderer::renderImage in Site Settings and Labels 8
Render a small version of the image.
Parameters
object $field: The field to render.
Return value
string The rendered html markup.
Throws
\Exception
1 call to SiteSettingsRenderer::renderImage()
- SiteSettingsRenderer::renderField in src/
SiteSettingsRenderer.php - Render the value of the added fields.
File
- src/
SiteSettingsRenderer.php, line 106
Class
- SiteSettingsRenderer
- Class SiteSettingsRenderer.
Namespace
Drupal\site_settingsCode
protected function renderImage($field) {
if (is_object($field) && isset($field->entity)) {
$build = [
'#theme' => 'image_style',
'#width' => $this->defaultImageWidth,
'#height' => $this->defaultImageHeight,
'#style_name' => 'thumbnail',
'#uri' => $field->entity
->getFileUri(),
];
}
else {
$build['#plain_text'] = $this
->t('(none)');
}
return $this->renderer
->render($build);
}