| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Yoast\WP\SEO\Helpers\Schema; |
| 4 | 4 | |
| 5 | -use Yoast\WP\SEO\Config\Schema_IDs; | |
| 6 | 5 | use Yoast\WP\SEO\Helpers\Image_Helper as Main_Image_Helper; |
| 7 | 6 | |
| 8 | 7 | /** |
| 9 | 8 | * Class Image_Helper. |
| @@ -48,17 +47,18 @@ | ||
| 48 | 47 | |
| 49 | 48 | /** |
| 50 | 49 | * Find an image based on its URL and generate a Schema object for it. |
| 51 | 50 | * |
| 52 | - * @param string $schema_id The `@id` to use for the returned image. | |
| 53 | - * @param string $url The image URL to base our object on. | |
| 54 | - * @param string $caption An optional caption. | |
| 55 | - * @param bool $add_hash Whether a hash will be added as a suffix in the @id. | |
| 51 | + * @param string $schema_id The `@id` to use for the returned image. | |
| 52 | + * @param string $url The image URL to base our object on. | |
| 53 | + * @param string $caption An optional caption. | |
| 54 | + * @param bool $add_hash Whether a hash will be added as a suffix in the @id. | |
| 55 | + * @param bool $use_link_table Whether the SEO Links table will be used to retrieve the id. | |
| 56 | 56 | * |
| 57 | 57 | * @return array Schema ImageObject array. |
| 58 | 58 | */ |
| 59 | - public function generate_from_url( $schema_id, $url, $caption = '', $add_hash = false ) { | |
| 60 | - $attachment_id = $this->image->get_attachment_by_url( $url ); | |
| 59 | + public function generate_from_url( $schema_id, $url, $caption = '', $add_hash = false, $use_link_table = true ) { | |
| 60 | + $attachment_id = $this->image->get_attachment_by_url( $url, $use_link_table ); | |
| 61 | 61 | if ( $attachment_id > 0 ) { |
| 62 | 62 | return $this->generate_from_attachment_id( $schema_id, $attachment_id, $caption, $add_hash ); |
| 63 | 63 | } |
| 64 | 64 | |