$fields Field values. * @param WP_Post $post The post. * @param Node_Context $c Page information. * @param Graph $graph The graph. * @return array|null */ public function build( string $type, array $fields, WP_Post $post, Node_Context $c, Graph $graph ): ?array { $name = $this->text( $fields, 'name', $this->title( $post ) ); $thumbnail = $this->image_url( $fields, 'thumbnail', $post ); $uploaded = $this->text( $fields, 'upload_date' ); if ( '' === $name || '' === $thumbnail || '' === $uploaded ) { return null; } return array( '@type' => 'VideoObject', '@id' => $c->id( 'video' ), 'mainEntityOfPage' => array( '@id' => $c->id( 'webpage' ) ), 'name' => $name, 'description' => $this->text( $fields, 'description', $this->description( $post, $c ) ), 'thumbnailUrl' => array( $thumbnail ), 'uploadDate' => $uploaded, 'contentUrl' => $this->text( $fields, 'content_url' ), 'embedUrl' => $this->text( $fields, 'embed_url' ), 'duration' => Field_Values::duration_from_seconds( (int) $this->text( $fields, 'duration' ) ), ); } }