public function fields(\Twig_Environment $env, $record = null, $common = true, $extended = false, $repeaters = true, $templateFields = true, $template = '_sub_fields.twig', $exclude = null, $skip_uses = true)
{
// If $record is empty, we must get it from the global scope in Twig.
if (!$record instanceof \Bolt\Legacy\Content) {
$globals = $env->getGlobals();
$record = isset($globals['record']) ? $globals['record'] : [];
}
// Still no record? Nothing to do here, then.
if (!$record instanceof \Bolt\Legacy\Content) {
return null;
}
if (!is_array($exclude)) {
$exclude = array_map('trim', explode(',', $exclude));
}
$context = ['record' => $record, 'common' => $common, 'extended' => $extended, 'repeaters' => $repeaters, 'templatefields' => $templateFields, 'exclude' => $exclude, 'skip_uses' => $skip_uses];
return new \Twig_Markup($env->render($template, $context), 'utf-8');
}