#[SettingsGroup]

Attribute on classes.

use Saij\WpAppFramework\Setting\SettingsGroup;

Declares a group of settings of a theme, child theme or plugin.

The class is readonly and declares each setting as a public promoted constructor parameter with a default, like a block attribute class: the types and markers of values (#[ListOf], #[Url], #[Label], #[Hidden], #[Image] for an attachment ID) derive the schema and the form. The framework stores the group in the option {namespace}_{name} (namespace of the theme or plugin with "_" instead of "-"), edits it on the settings page of the theme or plugin and injects it into the constructor of services that declare a parameter of its type; templates read it as settings.{name}.

Arguments

#[SettingsGroup(string $name, string $title, string $description = '', int $position = 10)]
ParameterTypeDefaultDescription
namestringrequiredName of the group: lowercase letters, digits and "_", starting with a letter (e.g. "general"); part of the option name and the key in templates.
titlestringrequiredTitle of the group on the settings page (the tab if there are several groups).
descriptionstring''Optional text above the form of the group.
positionint10Order of the groups on the settings page: lower first, then by name.