private function loadForm()
{
$this->frm = new BackendForm('settingsThemes');
// fetch the themes
$themes = $this->installedThemes;
// set selected theme
$selected = isset($_POST['installedThemes']) ? $_POST['installedThemes'] : $this->get('fork.settings')->get('Core', 'theme', 'core');
// no themes found
if (empty($themes)) {
$this->redirect(BackendModel::createURLForAction('Edit') . '&id=' . $this->id . '&step=1&error=no-themes');
}
// loop the templates
foreach ($themes as &$record) {
// reformat custom variables
$record['variables']['thumbnail'] = $record['thumbnail'];
$record['variables']['installed'] = $record['installed'];
$record['variables']['installable'] = $record['installable'];
// set selected template
if ($record['value'] == $selected) {
$record['variables']['selected'] = true;
}
// unset the variable field
unset($record['thumbnail'], $record['installed'], $record['installable']);
}
// templates
$this->frm->addRadiobutton('installedThemes', $themes, $selected);
}