public function export_for_template(\renderer_base $output) {

        $components = [];

        foreach ($this->models as $componentname => $modelslist) {
            $component = [
                'name' => $this->component_name($componentname),
                'component' => $componentname,
                'models' => [],
            ];

            foreach ($modelslist as $definition) {
                list($target, $indicators) = \core_analytics\manager::get_declared_target_and_indicators_instances($definition);

                if (\core_analytics\model::exists($target, $indicators)) {
                    continue;
                }

                $targetnamelangstring = $target->get_name();

                $model = [
                    'defid' => \core_analytics\manager::model_declaration_identifier($definition),
                    'targetname' => $targetnamelangstring,
                    'targetclass' => $definition['target'],
                    'indicatorsnum' => count($definition['indicators']),
                    'indicators' => [],
                ];

                if (get_string_manager()->string_exists($targetnamelangstring->get_identifier().'_help',
                        $targetnamelangstring->get_component())) {
                    $helpicon = new \help_icon($targetnamelangstring->get_identifier(), $targetnamelangstring->get_component());
                    $model['targethelp'] = $helpicon->export_for_template($output);
                }

                foreach ($indicators as $indicator) {
                    $indicatornamelangstring = $indicator->get_name();
                    $indicatordata = [
                        'name' => $indicatornamelangstring,
                        'classname' => $indicator->get_id(),
                    ];

                    if (get_string_manager()->string_exists($indicatornamelangstring->get_identifier().'_help',
                            $indicatornamelangstring->get_component())) {
                        $helpicon = new \help_icon($indicatornamelangstring->get_identifier(),
                            $indicatornamelangstring->get_component());
                        $indicatordata['indicatorhelp'] = $helpicon->export_for_template($output);
                    }

                    $model['indicators'][] = $indicatordata;
                }

                $component['models'][] = $model;
            }

            if (!empty($component['models'])) {
                $components[] = $component;
            }
        }

        $result = [
            'hasdata' => !empty($components),
            'components' => array_values($components),
            'submiturl' => new \moodle_url('/admin/tool/analytics/restoredefault.php'),
            'backurl' => new \moodle_url('/admin/tool/analytics/index.php'),
            'sesskey' => sesskey(),
        ];

        return $result;
    }