Yoast\WP\SEO\Helpers\Schema
Image_Helper::simple_image_object
If we can't find $url in our database, we output a simple ImageObject.
Метод класса: Image_Helper{}
Хуков нет.
Возвращает
Массив. Schema ImageObject array.
Использование
$Image_Helper = new Image_Helper(); $Image_Helper->simple_image_object( $schema_id, $url, $caption, $add_hash );
- $schema_id(строка) (обязательный)
- The
@idto use for the returned image. - $url(строка) (обязательный)
- The image URL.
- $caption(строка)
- A caption, if set.
По умолчанию:'' - $add_hash(true|false)
- Whether a hash will be added as a suffix in the @id.
По умолчанию:false
Код Image_Helper::simple_image_object() Image Helper::simple image object Yoast 28.2
public function simple_image_object( $schema_id, $url, $caption = '', $add_hash = false ) {
$data = $this->generate_object();
$id_suffix = ( $add_hash ) ? \md5( $url ) : '';
$data['@id'] = $schema_id . $id_suffix;
$data['url'] = $url;
$data['contentUrl'] = $url;
if ( ! empty( $caption ) ) {
$data['caption'] = $this->html->smart_strip_tags( $caption );
}
return $data;
}