private renderContentField ( eZ\Publish\API\Repository\Values\Content\Field $field, string $fieldTypeIdentifier, array $params, integer $type ) : string | ||
$field | eZ\Publish\API\Repository\Values\Content\Field | |
$fieldTypeIdentifier | string | |
$params | array | |
$type | integer | Either self::VIEW or self::EDIT |
return | string |
private function renderContentField(Field $field, $fieldTypeIdentifier, array $params, $type)
{
$localTemplate = null;
if (isset($params['template'])) {
// local override of the template
// this template is put on the top the templates stack
$localTemplate = $params['template'];
unset($params['template']);
}
$params += ['field' => $field];
// Getting instance of Twig_Template that will be used to render blocks
if (is_string($this->baseTemplate)) {
$this->baseTemplate = $this->twig->loadTemplate($this->baseTemplate);
}
return $this->baseTemplate->renderBlock($this->getRenderFieldBlockName($fieldTypeIdentifier, $type), $this->twig->mergeGlobals($params), $this->getBlocksByField($fieldTypeIdentifier, $type, $localTemplate));
}