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