PhoenixKit.Settings.Setting.SettingsForm (phoenix_kit v1.6.4)
View SourceSettings form schema for PhoenixKit system settings validation.
This embedded schema provides validation for the settings form in the admin panel. It handles validation for core system settings like timezone, date format, and time format.
Fields
project_title: Application/project titlesite_url: Website URL for the application (optional)allow_registration: Allow public user registration (true/false)time_zone: System timezone offset (-12 to +12)date_format: Date display format (Y-m-d, m/d/Y, etc.)time_format: Time display format (H:i for 24-hour, h:i A for 12-hour)track_registration_geolocation: Enable IP geolocation tracking during registration (true/false)
Usage Examples
# Create a changeset for validation
%PhoenixKit.Settings.Setting.SettingsForm{}
|> PhoenixKit.Settings.Setting.SettingsForm.changeset(%{
project_title: "My App",
time_zone: "0",
date_format: "Y-m-d",
time_format: "H:i"
})
# Validate existing settings
form_data = struct(PhoenixKit.Settings.Setting.SettingsForm, %{project_title: "My App", ...})
PhoenixKit.Settings.Setting.SettingsForm.changeset(form_data, %{time_zone: "+5"})
Summary
Functions
Creates a changeset for settings form validation.
Functions
Creates a changeset for settings form validation.
Validates that all required fields are present and have valid values.
Validations
- All fields are required
project_title: 1-100 characterstime_zone: Must be a valid timezone offset (-12 to +12)date_format: Must be one of the supported formatstime_format: Must be one of the supported formats
Examples
iex> PhoenixKit.Settings.Setting.SettingsForm.changeset(%PhoenixKit.Settings.Setting.SettingsForm{}, %{project_title: "My App"})
%Ecto.Changeset{valid?: false} # Missing required fields
iex> valid_attrs = %{
...> project_title: "My App",
...> time_zone: "0",
...> date_format: "Y-m-d",
...> time_format: "H:i"
...> }
iex> PhoenixKit.Settings.Setting.SettingsForm.changeset(%PhoenixKit.Settings.Setting.SettingsForm{}, valid_attrs)
%Ecto.Changeset{valid?: true}