class-field-suggestions.php 1015 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\ConfigurationUI
  6. */
  7. /**
  8. * Holds the suggestions for the 'You might also like' page in the wizard
  9. */
  10. class WPSEO_Config_Field_Suggestions extends WPSEO_Config_Field {
  11. /**
  12. * WPSEO_Config_Field_Suggestions constructor.
  13. */
  14. public function __construct() {
  15. parent::__construct( 'suggestions', 'Suggestions' );
  16. $this->properties['suggestions'] = array();
  17. }
  18. /**
  19. * Adds a suggestion to the properties
  20. *
  21. * @param string $title The title of the choice.
  22. * @param string $copy The text explaining the choice.
  23. * @param array $button The button details.
  24. * @param null|string $video The video accompanying the choice.
  25. */
  26. public function add_suggestion( $title, $copy, $button, $video = null ) {
  27. $suggestion = array(
  28. 'title' => $title,
  29. 'copy' => $copy,
  30. 'button' => $button,
  31. );
  32. if ( ! empty( $video ) ) {
  33. $suggestion['video'] = $video;
  34. }
  35. $this->properties['suggestions'][] = $suggestion;
  36. }
  37. }