1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* The Team Schema for LSX Team |
4
|
|
|
* |
5
|
|
|
* @package lsx-team |
6
|
|
|
*/ |
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Returns schema Review data. |
9
|
|
|
* |
10
|
|
|
* @since 10.2 |
11
|
|
|
*/ |
12
|
|
|
class LSX_Team_Schema extends LSX_Schema_Graph_Piece { |
13
|
|
|
/** |
14
|
|
|
* Constructor. |
15
|
|
|
* |
16
|
|
|
* @param \WPSEO_Schema_Context $context A value object with context variables. |
17
|
|
|
*/ |
18
|
|
|
public function __construct( WPSEO_Schema_Context $context ) { |
|
|
|
|
19
|
|
|
$this->post_type = 'team'; |
20
|
|
|
parent::__construct( $context ); |
21
|
|
|
} |
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Returns Review data. |
24
|
|
|
* |
25
|
|
|
* @return array $data Review data. |
26
|
|
|
*/ |
27
|
|
|
public function generate() { |
28
|
|
|
$data = array( |
29
|
|
|
'@type' => array( |
30
|
|
|
'Person', |
31
|
|
|
), |
32
|
|
|
'@id' => $this->context->canonical . '#person', |
33
|
|
|
'name' => $this->post->post_title, |
34
|
|
|
'description' => wp_strip_all_tags( $this->post->post_content ), |
35
|
|
|
'url' => $this->post_url, |
36
|
|
|
'mainEntityOfPage' => array( |
37
|
|
|
'@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, |
|
|
|
|
38
|
|
|
), |
39
|
|
|
); |
40
|
|
|
if ( $this->context->site_represents_reference ) { |
|
|
|
|
41
|
|
|
$data['worksFor'] = $this->context->site_represents_reference; |
42
|
|
|
$data['memberOf'] = $this->context->site_represents_reference; |
43
|
|
|
} |
|
|
|
|
44
|
|
|
$data = $this->add_custom_field( $data, 'jobTitle', 'lsx_job_title' ); |
45
|
|
|
$data = $this->add_custom_field( $data, 'email', 'lsx_email_contact' ); |
46
|
|
|
$data = $this->add_custom_field( $data, 'telephone', 'lsx_tel' ); |
47
|
|
|
$data = LSX_Schema_Utils::add_image( $data, $this->context ); |
48
|
|
|
return $data; |
49
|
|
|
} |
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Adds the projects and testimonials under the 'owns' parameter |
52
|
|
|
* |
53
|
|
|
* @param array $data |
|
|
|
|
54
|
|
|
* @return array |
55
|
|
|
*/ |
56
|
|
|
public function add_products( $data ) { |
57
|
|
|
$connections_array = array(); |
58
|
|
|
$connections_array = $this->add_project( $connections_array ); |
59
|
|
|
$connections_array = $this->add_testimonial( $connections_array ); |
60
|
|
|
if ( ! empty( $connections_array ) ) { |
|
|
|
|
61
|
|
|
$data['owns'] = $connections_array; |
62
|
|
|
} |
|
|
|
|
63
|
|
|
return $data; |
64
|
|
|
} |
|
|
|
|
65
|
|
|
} |
66
|
|
|
|