public function user_field_mappings_table($userfieldmappings, $issuerid) {
        global $CFG;

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

        $index = 0;

        foreach ($userfieldmappings as $userfieldmapping) {
            // External field.
            $externalfield = $userfieldmapping->get('externalfield');
            $externalfieldcell = new html_table_cell(s($externalfield));

            // Internal field.
            $internalfield = $userfieldmapping->get('internalfield');
            $internalfieldcell = new html_table_cell(s($internalfield));

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

            // Delete.
            $deleteparams = ['issuerid' => $issuerid, 'userfieldmappingid' => $userfieldmapping->get('id'), 'action' => 'delete'];
            $deleteurl = new moodle_url('/admin/tool/oauth2/userfieldmappings.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([
                $externalfieldcell,
                $internalfieldcell,
                $editcell,
            ]);

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