public function endpoints_table($endpoints, $issuerid) {
        global $CFG;

        $table = new html_table();
        $table->head  = [
            get_string('name'),
            get_string('url'),
            get_string('edit'),
        ];
        $table->attributes['class'] = 'admintable generaltable';
        $data = [];

        $index = 0;

        foreach ($endpoints as $endpoint) {
            // Name.
            $name = $endpoint->get('name');
            $namecell = new html_table_cell(s($name));
            $namecell->header = true;

            // Url.
            $url = $endpoint->get('url');
            $urlcell = new html_table_cell(s($url));

            $links = '';
            // Action links.
            $editparams = ['issuerid' => $issuerid, 'endpointid' => $endpoint->get('id'), 'action' => 'edit'];
            $editurl = new moodle_url('/admin/tool/oauth2/endpoints.php', $editparams);
            $editlink = html_writer::link($editurl, $this->pix_icon('t/edit', get_string('edit')));
            $links .= ' ' . $editlink;

            // Delete.
            $deleteparams = ['issuerid' => $issuerid, 'endpointid' => $endpoint->get('id'), 'action' => 'delete'];
            $deleteurl = new moodle_url('/admin/tool/oauth2/endpoints.php', $deleteparams);
            $deletelink = html_writer::link($deleteurl, $this->pix_icon('t/delete', get_string('delete')));
            $links .= ' ' . $deletelink;

            $editcell = new html_table_cell($links);

            $row = new html_table_row([
                $namecell,
                $urlcell,
                $editcell,
            ]);

            $data[] = $row;
            $index++;
        }
        $table->data = $data;
        return html_writer::table($table);
    }