Yoast\WP\SEO\Builders
Indexable_Link_Builder::enhance_link_from_indexable()
Enhances the link model with information from its indexable.
Метод класса: Indexable_Link_Builder{}
Хуков нет.
Возвращает
SEO_Links
. The enhanced link model.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->enhance_link_from_indexable( $model, $permalink );
- $model(SEO_Links) (обязательный)
- The link's model.
- $permalink(строка) (обязательный)
- The link's permalink.
Код Indexable_Link_Builder::enhance_link_from_indexable() Indexable Link Builder::enhance link from indexable Yoast 23.4
protected function enhance_link_from_indexable( $model, $permalink ) { $target = $this->indexable_repository->find_by_permalink( $permalink ); if ( ! $target ) { // If target indexable cannot be found, create one based on the post's post ID. $post_id = $this->get_post_id( $model->type, $permalink ); if ( $post_id && $post_id !== 0 ) { $target = $this->indexable_repository->find_by_id_and_type( $post_id, 'post' ); } } if ( ! $target ) { return $model; } $model->target_indexable_id = $target->id; if ( $target->object_type === 'post' ) { $model->target_post_id = $target->object_id; } if ( $model->target_indexable_id ) { $model->language = $target->language; $model->region = $target->region; } return $model; }