public static function get_name($purposeid) {
        global $PAGE;
        if ($purposeid === false || $purposeid == context_instance::INHERIT) {
            return get_string('inherit', 'tool_dataprivacy');
        } else if ($purposeid == context_instance::NOTSET) {
            return get_string('notset', 'tool_dataprivacy');
        } else {
            $purpose = new purpose($purposeid);
            $output = $PAGE->get_renderer('tool_dataprivacy');
            $exporter = new self($purpose, ['context' => \context_system::instance()]);
            $data = $exporter->export($output);
            return $data->name;
        }
    }