1 | <?php |
||||
2 | /** |
||||
3 | * The Team Schema for Tours |
||||
4 | * |
||||
5 | * @package tour-operator |
||||
6 | */ |
||||
7 | |||||
8 | /** |
||||
9 | * Returns schema Review data. |
||||
10 | * |
||||
11 | * @since 10.2 |
||||
12 | */ |
||||
13 | class LSX_TO_Team_Schema extends LSX_TO_Schema_Graph_Piece { |
||||
14 | |||||
15 | /** |
||||
16 | * Constructor. |
||||
17 | * |
||||
18 | * @param \WPSEO_Schema_Context $context A value object with context variables. |
||||
19 | */ |
||||
20 | public function __construct( WPSEO_Schema_Context $context ) { |
||||
21 | $this->post_type = 'team'; |
||||
22 | parent::__construct( $context ); |
||||
23 | } |
||||
24 | |||||
25 | /** |
||||
26 | * Returns Review data. |
||||
27 | * |
||||
28 | * @return array $data Review data. |
||||
29 | */ |
||||
30 | public function generate() { |
||||
31 | $data = array( |
||||
32 | '@type' => array( |
||||
33 | 'Person', |
||||
34 | ), |
||||
35 | '@id' => $this->context->canonical . '#person', |
||||
36 | 'name' => $this->post->post_title, |
||||
37 | 'description' => wp_strip_all_tags( $this->post->post_content ), |
||||
38 | 'url' => $this->post_url, |
||||
39 | 'mainEntityOfPage' => array( |
||||
40 | '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, |
||||
41 | ), |
||||
42 | ); |
||||
43 | |||||
44 | if ( $this->context->site_represents_reference ) { |
||||
45 | $data['worksFor'] = $this->context->site_represents_reference; |
||||
46 | $data['memberOf'] = $this->context->site_represents_reference; |
||||
47 | } |
||||
48 | |||||
49 | $data = $this->add_taxonomy_terms( $data, 'jobTitle', 'role' ); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() 'jobTitle' of type string is incompatible with the type array expected by parameter $data_key of LSX_TO_Schema_Graph_Piece::add_taxonomy_terms() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
50 | $data = $this->add_custom_field( $data, 'email', 'contact_email' ); |
||||
51 | $data = $this->add_custom_field( $data, 'telephone', 'contact_number' ); |
||||
52 | $data = $this->add_products( $data ); |
||||
53 | $data = $this->add_offers( $data, 'makesOffer' ); |
||||
54 | $data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context ); |
||||
55 | return $data; |
||||
56 | } |
||||
57 | |||||
58 | /** |
||||
59 | * Adds the accommodation and tour products under the 'owns' parameter |
||||
60 | * |
||||
61 | * @param array $data |
||||
62 | * @return array |
||||
63 | */ |
||||
64 | public function add_products( $data ) { |
||||
65 | $places_array = array(); |
||||
66 | $places_array = $this->add_accommodation( $places_array ); |
||||
67 | $places_array = $this->add_tours( $places_array ); |
||||
68 | if ( ! empty( $places_array ) ) { |
||||
69 | $data['owns'] = $places_array; |
||||
70 | } |
||||
71 | return $data; |
||||
72 | } |
||||
73 | } |
||||
74 |