| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Values\Open_Graph; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Helpers\Open_Graph\Image_Helper as Open_Graph_Image_Helper; |
| 6 |
use Yoast\WP\SEO\Values\Images as Base_Images; |
| 7 |
|
| 8 |
/** |
| 9 |
* Value object for the Open Graph Images. |
| 10 |
*/ |
| 11 |
class Images extends Base_Images { |
| 12 |
|
| 13 |
/** |
| 14 |
* The Open Graph image helper. |
| 15 |
* |
| 16 |
* @var Open_Graph_Image_Helper |
| 17 |
*/ |
| 18 |
protected $open_graph_image; |
| 19 |
|
| 20 |
/** |
| 21 |
* Sets the helpers. |
| 22 |
* |
| 23 |
* @required |
| 24 |
* |
| 25 |
* @codeCoverageIgnore - Is handled by DI-container. |
| 26 |
* |
| 27 |
* @param Open_Graph_Image_Helper $open_graph_image Image helper for Open Graph. |
| 28 |
*/ |
| 29 |
public function set_helpers( Open_Graph_Image_Helper $open_graph_image ) { |
| 30 |
$this->open_graph_image = $open_graph_image; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Outputs the images. |
| 35 |
* |
| 36 |
* @codeCoverageIgnore - The method is empty, nothing to test. |
| 37 |
* |
| 38 |
* @return void |
| 39 |
*/ |
| 40 |
public function show() {} |
| 41 |
|
| 42 |
/** |
| 43 |
* Adds an image to the list by image ID. |
| 44 |
* |
| 45 |
* @param int $image_id The image ID to add. |
| 46 |
* |
| 47 |
* @return void |
| 48 |
*/ |
| 49 |
public function add_image_by_id( $image_id ) { |
| 50 |
$attachment = $this->open_graph_image->get_image_by_id( $image_id ); |
| 51 |
|
| 52 |
if ( $attachment ) { |
| 53 |
$this->add_image( $attachment ); |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
|