Yoast\WP\SEO\Bulk_Editor\Infrastructure\Posts
Default_Template_Resolver::resolve
Resolves a raw template string for a given post type, stored value, and option key prefix.
Метод класса: Default_Template_Resolver{}
Хуков нет.
Возвращает
string. The raw template string, or an empty string when no template is configured.
Использование
// private - только в коде основоного (родительского) класса $result = $this->resolve( $post_type, $stored_value, $option_key_prefix, $use_installation_default ): string;
- $post_type(строка) (обязательный)
- The post type slug.
- $stored_value(строка) (обязательный)
- The raw stored value (empty string when never explicitly saved).
- $option_key_prefix(строка) (обязательный)
- The option key prefix (e.g.
title-,metadesc-). - $use_installation_default(true|false) (обязательный)
- Whether to fall back to the installation default when the configured template is empty.
Код Default_Template_Resolver::resolve() Default Template Resolver::resolve Yoast 28.9
private function resolve( string $post_type, string $stored_value, string $option_key_prefix, bool $use_installation_default ): string {
if ( $stored_value !== '' ) {
return $stored_value;
}
$option_key = $option_key_prefix . $post_type;
$template = (string) $this->options_helper->get( $option_key, '' );
if ( $use_installation_default && $template === '' ) {
$template = (string) $this->options_helper->get_title_default( $option_key );
}
return $template;
}