Yoast\WP\SEO\Generators\Schema
Person::add_image()
Returns an ImageObject for the persons avatar.
Метод класса: Person{}
Хуков нет.
Возвращает
Массив
. The Person schema.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->add_image( $data, $user_data, $add_hash );
- $data(массив) (обязательный)
- The Person schema.
- $user_data(WP_User) (обязательный)
- User data.
- $add_hash(true|false)
- Wether or not the person's image url hash should be added to the image id.
По умолчанию: false
Код Person::add_image() Person::add image Yoast 21.6
protected function add_image( $data, $user_data, $add_hash = false ) { $schema_id = $this->context->site_url . Schema_IDs::PERSON_LOGO_HASH; $data = $this->set_image_from_options( $data, $schema_id, $add_hash, $user_data ); if ( ! isset( $data['image'] ) ) { $data = $this->set_image_from_avatar( $data, $user_data, $schema_id, $add_hash ); } if ( \is_array( $this->type ) && \in_array( 'Organization', $this->type, true ) ) { $data_logo = isset( $data['image']['@id'] ) ? $data['image']['@id'] : $schema_id; $data['logo'] = [ '@id' => $data_logo ]; } return $data; }