getRootPageForm = (pages, pageGroups, roles, req) => {
  const form = new Form({
    action: "/pageedit/set_root_page",
    noSubmitButton: true,
    onChange: "saveAndContinue(this)",
    blurb: req.__(
      "The home page is the page that is served when the user visits the home location (/). This can be set for each user role."
    ),
    fields: roles.map(
      (r) =>
        new Field({
          name: r.role,
          label: r.role,
          input_type: "select",
          options: [
            "",
            ...pages.filter((p) => p.min_role >= r.id).map((p) => p.name),
            ...pageGroups.map((g) => ({
              label: `${g.name} (group)`,
              value: g.name,
            })),
          ],
        })
    ),
  });
  const modernCfg = getState().getConfig("home_page_by_role", false);
  for (const role of roles) {
    form.values[role.role] = modernCfg && modernCfg[role.id];
    if (typeof form.values[role.role] !== "string")
      form.values[role.role] = getState().getConfig(role.role + "_home", "");
  }
  return form;
}
Root pages configuration Form
Allows to configure root page for each role
Groups are listed under the pages (perhaps we need something to switch between input-selects)
@param {Page[]} pages list of pages
@param {PageGroup[]} pageGroups list of page groups
@param {Row[]} roles - list of roles
@param {any} req - request
@returns {Form} return Form