Bolt\Twig\Handler\RecordHandler::fields PHP Method

fields() public method

Output all (relevant) fields to the browser. Convenient for dumping the content in order in, say, a record.twig template, without having to iterate over them in the browser.
public fields ( Twig_Environment $env, Content $record = null, boolean $common = true, boolean $extended = false, boolean $repeaters = true, boolean $templateFields = true, string $template = '_sub_fields.twig', string | array $exclude = null, boolean $skip_uses = true ) : string
$env Twig_Environment
$record Bolt\Legacy\Content
$common boolean
$extended boolean
$repeaters boolean
$templateFields boolean
$template string
$exclude string | array
$skip_uses boolean
return string
    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');
    }