class-field-configuration-choices.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\ConfigurationUI
  6. */
  7. /**
  8. * Holds the choices for the Configuration method to be chosen in the first step of the wizard
  9. */
  10. class WPSEO_Config_Field_Configuration_Choices extends WPSEO_Config_Field {
  11. /**
  12. * WPSEO_Config_Field_Choice constructor.
  13. */
  14. public function __construct() {
  15. parent::__construct( 'configurationChoices', 'ConfigurationChoices' );
  16. $this->properties['choices'] = array();
  17. }
  18. /**
  19. * Adds a choice 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 $image The image accompanying the choice.
  25. */
  26. public function add_choice( $title, $copy, $button, $image = null ) {
  27. $choice = array(
  28. 'title' => $title,
  29. 'copy' => $copy,
  30. 'button' => $button,
  31. );
  32. if ( ! empty( $image ) ) {
  33. $choice['image'] = $image;
  34. }
  35. $this->properties['choices'][] = $choice;
  36. }
  37. }