Skip to content

Commit

Permalink
Fix the @id for the author image
Browse files Browse the repository at this point in the history
  • Loading branch information
Joost de Valk committed May 22, 2019
1 parent 3fba613 commit 4ef6383
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions frontend/schema/class-schema-author.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class WPSEO_Schema_Author extends WPSEO_Schema_Person implements WPSEO_Graph_Pie
*/
public function __construct( WPSEO_Schema_Context $context ) {
parent::__construct( $context );
$this->context = $context;
$this->logo_hash = WPSEO_Schema_IDs::AUTHOR_LOGO_HASH;
$this->context = $context;
$this->image_hash = WPSEO_Schema_IDs::AUTHOR_LOGO_HASH;
}

/**
Expand Down
12 changes: 10 additions & 2 deletions frontend/schema/class-schema-person.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,21 @@ class WPSEO_Schema_Person implements WPSEO_Graph_Piece {
'Organization',
);

/**
* The hash used for images.
*
* @var string
*/
protected $image_hash;

/**
* WPSEO_Schema_Person constructor.
*
* @param WPSEO_Schema_Context $context A value object with context variables.
*/
public function __construct( WPSEO_Schema_Context $context ) {
$this->context = $context;
$this->image_hash = WPSEO_Schema_IDs::PERSON_LOGO_HASH;
$this->context = $context;
}

/**
Expand Down Expand Up @@ -166,7 +174,7 @@ protected function build_person_data( $user_id ) {
* @return array $data The Person schema.
*/
protected function add_image( $data, $user_data ) {
$schema_id = $this->context->site_url . WPSEO_Schema_IDs::PERSON_LOGO_HASH;
$schema_id = $this->context->site_url . $this->image_hash;

$data = $this->set_image_from_options( $data, $schema_id );
if ( ! isset( $data['image'] ) ) {
Expand Down

0 comments on commit 4ef6383

Please sign in to comment.