function getFieldObjects_fromSchema($schema)
{
    $fields = array();
    foreach ($schema as $name => $fieldSchema) {
        if (!is_array($fieldSchema)) {
            continue;
        }
        // fields are stored as arrays, other entries are table metadata
        $fieldSchema['name'] = $name;
        $field = createFieldObject_fromSchema($fieldSchema);
        if (!$field) {
            continue;
        }
        $fields[] = $field;
    }
    return $fields;
}
function _showrelatedRecords($fieldSchema, $record)
{
    $field = createFieldObject_fromSchema($fieldSchema);
    $value = @$record[$fieldSchema['name']];
    print $field->getTableRow($record, $value, 'edit');
}