public function format_definition($line, $grade) {
        foreach ($this->definition() as $i => $field) {
            // Table tab index.
            $tab = ($i * $this->total) + $this->index;
            $classname = '\\gradereport_singleview\\local\\ui\\' . $field;
            $html = new $classname($grade, $tab);

            if ($field == 'finalgrade' and !empty($this->structure)) {
                $html .= $this->structure->get_grade_analysis_icon($grade);
            }

            // Singleview users without proper permissions should be presented
            // disabled checkboxes for the Exclude grade attribute.
            if ($field == 'exclude' && !has_capability('moodle/grade:manage', $this->context)){
                $html->disabled = true;
            }

            $line[] = $html;
        }
        return $line;
    }