Yoast\WP\SEO\Generators\Schema
HowTo::add_step_image
Checks if we have a step image, if we do, add it.
Метод класса: HowTo{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_step_image( $schema_step, $step );
- $schema_step(массив) (обязательный) (передается по ссылке — &)
- Our Schema output for the Step.
- $step(массив) (обязательный)
- The step block data.
Код HowTo::add_step_image() HowTo::add step image Yoast 28.4
private function add_step_image( &$schema_step, $step ) {
if ( isset( $step['images'] ) && \is_array( $step['images'] ) ) {
foreach ( $step['images'] as $image ) {
if ( isset( $image['type'] ) && $image['type'] === 'img' ) {
$schema_step['image'] = $this->get_image_schema( \esc_url( $image['props']['src'] ) );
}
}
}
elseif ( isset( $step['text'] ) && \is_array( $step['text'] ) ) {
// Backwards compatibility for older How-To blocks.
foreach ( $step['text'] as $line ) {
if ( \is_array( $line ) && isset( $line['type'] ) && $line['type'] === 'img' ) {
$schema_step['image'] = $this->get_image_schema( \esc_url( $line['props']['src'] ) );
}
}
}
}