Yoast\WP\SEO\Abilities\Application
Site_Representation_Updater::get_settings
Returns the current value of each field, cast to the type its schema declares.
Метод класса: Site_Representation_Updater{}
Хуков нет.
Возвращает
array<string, mixed>. The current value of each field.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_settings( $fields ): array;
- $fields(массив) (обязательный)
- .
Код Site_Representation_Updater::get_settings() Site Representation Updater::get settings Yoast 28.8
private function get_settings( array $fields ): array {
$settings = [];
foreach ( $fields as $field_name => $schema ) {
$value = $this->options_helper->get( $field_name );
// Unset options come back as their default, which is not always of the declared type
// (the user ID defaults to false, for example).
switch ( ( $schema['type'] ?? null ) ) {
case 'integer':
$value = (int) $value;
break;
case 'string':
$value = (string) $value;
break;
}
$settings[ $field_name ] = $value;
}
return $settings;
}