public function SiteSettingsRenderer::renderField in Site Settings and Labels 8
Render the value of the added fields.
Parameters
object $field: The field to render.
Return value
\Drupal\Component\Render\MarkupInterface|string The rendered html markup.
Throws
\Exception
File
- src/
SiteSettingsRenderer.php, line 78
Class
- SiteSettingsRenderer
- Class SiteSettingsRenderer.
Namespace
Drupal\site_settingsCode
public function renderField($field) {
// Get information about the field.
$definition = $field
->getFieldDefinition();
$field_type = $definition
->getType();
// Depending on the type of field, decide how to render.
switch ($field_type) {
case 'image':
return $this
->renderImage($field);
default:
return $this
->renderDefault($field, $field_type);
}
}