HEX
Server: Apache/2.4.54 (Debian)
System: Linux a5825d2beacc 4.15.0-197-generic #208-Ubuntu SMP Tue Nov 1 17:23:37 UTC 2022 x86_64
User: root (0)
PHP: 8.1.14
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/wordpress-seo/admin/config-ui/fields/class-field-suggestions.php
<?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Holds the suggestions for the 'You might also like' page in the wizard
 */
class WPSEO_Config_Field_Suggestions extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Suggestions constructor.
	 */
	public function __construct() {
		parent::__construct( 'suggestions', 'Suggestions' );

		$this->properties['suggestions'] = array();
	}

	/**
	 * Adds a suggestion to the properties
	 *
	 * @param string $title  The title of the choice.
	 * @param string $copy   The text explaining the choice.
	 * @param array  $button The button details.
	 * @param array  $video  URL and title of the video accompanying the choice.
	 */
	public function add_suggestion( $title, $copy, $button, array $video = array() ) {
		$suggestion = array(
			'title'  => $title,
			'copy'   => $copy,
			'button' => $button,
		);

		if ( ! empty( $video ) ) {
			$suggestion['video'] = $video;
		}

		$this->properties['suggestions'][] = $suggestion;
	}
}