Yoast\WP\SEO\Generators\Schema
HowTo::add_duration
Adds the duration of the task to the Schema.
Метод класса: HowTo{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_duration( $data, $attributes );
- $data(массив) (обязательный) (передается по ссылке — &)
- Our How-To schema data.
- $attributes(массив) (обязательный)
- The block data attributes.
Код HowTo::add_duration() HowTo::add duration Yoast 27.6
private function add_duration( &$data, $attributes ) {
if ( empty( $attributes['hasDuration'] ) ) {
return;
}
$days = empty( $attributes['days'] ) ? 0 : $attributes['days'];
$hours = empty( $attributes['hours'] ) ? 0 : $attributes['hours'];
$minutes = empty( $attributes['minutes'] ) ? 0 : $attributes['minutes'];
if ( ( $days + $hours + $minutes ) > 0 ) {
$data['totalTime'] = \esc_attr( 'P' . $days . 'DT' . $hours . 'H' . $minutes . 'M' );
}
}