Yoast\WP\SEO\Memoizers
Presentation_Memoizer::get() public Yoast 1.0
Gets the presentation of an indexable for a specific page type. This function is memoized by the indexable so every call with the same indexable will yield the same result.
{} Это метод класса: Presentation_Memoizer{}
Хуков нет.
Возвращает
Indexable_Presentation. The indexable presentation.
Использование
$Presentation_Memoizer = new Presentation_Memoizer(); $Presentation_Memoizer->get( $indexable, $context, $page_type );
- $indexable(Indexable) (обязательный)
- The indexable to get a presentation of.
- $context(Meta_Tags_Context) (обязательный)
- The current meta tags context.
- $page_type(строка) (обязательный)
- The page type.
Код Presentation_Memoizer::get() Presentation Memoizer::get Yoast 15.7
public function get( Indexable $indexable, Meta_Tags_Context $context, $page_type ) {
if ( ! isset( $this->cache[ $indexable->id ] ) ) {
$presentation = $this->container->get( "Yoast\WP\SEO\Presentations\Indexable_{$page_type}_Presentation", ContainerInterface::NULL_ON_INVALID_REFERENCE );
if ( ! $presentation ) {
$presentation = $this->container->get( Indexable_Presentation::class );
}
$context->presentation = $presentation->of(
[
'model' => $indexable,
'context' => $context,
]
);
$this->cache[ $indexable->id ] = $context->presentation;
}
return $this->cache[ $indexable->id ];
}