{{!
    This file is part of Moodle - https://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template file/format/classes/output/courseformat/content/section

    Contenttype content manager class.

    Context variables required for this template:
    * component
    * copyright

    Example context (json):
    {
        "component": "local_test",
        "copyright": "2021 David Mudrák <david@moodle.com>"
    }
}}
{{< common/boilerplate_php }}
{{$ description }}{{ name }} content class.{{/ description }}
{{$ package }}{{ component }}{{/ package }}
{{$ copyright }}{{ copyright }}{{/ copyright }}
{{$ namespace }}
namespace {{ component }}\output\courseformat\content\section;
{{/ namespace }}
{{$ use }}
use core_courseformat\output\local\content\section\cmitem as cmitem_base;
use renderer_base;
use stdClass;
{{/ use }}
{{/ common/boilerplate_php }}
class cmitem extends cmitem_base {

    /**
     * Returns the output class template path.
     *
     * This method redirects the default template when the course content is rendered.
     */
    public function get_template_name(\renderer_base $renderer): string {
        return '{{ component }}/local/content/section/cmitem';
    }

    /**
     * Example of override export for template data.
     *
     * @param renderer_base $output typically, the renderer that's calling this function
     * @return stdClass data context for a mustache template
     */
    public function export_for_template(renderer_base $output): stdClass {
        $format = $this->format;
        $data = parent::export_for_template($output);
        // Add any data attribute here. Consider following as an example.
        $data->sampledata = $format->get_format();
        // Use $format->get_output_classname('relative\\output\\path'); to get the
        // any core output class name with namespace.
        return $data;
    }
}
