| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Integrations\Alerts; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Integrations\Integration_Interface; |
| 6 |
|
| 7 |
/** |
| 8 |
* Dismissable_Alert class. |
| 9 |
*/ |
| 10 |
abstract class Abstract_Dismissable_Alert implements Integration_Interface { |
| 11 |
|
| 12 |
/** |
| 13 |
* Holds the alert identifier. |
| 14 |
* |
| 15 |
* @var string |
| 16 |
*/ |
| 17 |
protected $alert_identifier; |
| 18 |
|
| 19 |
/** |
| 20 |
* {@inheritDoc} |
| 21 |
*/ |
| 22 |
public static function get_conditionals() { |
| 23 |
return []; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* {@inheritDoc} |
| 28 |
*/ |
| 29 |
public function register_hooks() { |
| 30 |
\add_filter( 'wpseo_allowed_dismissable_alerts', [ $this, 'register_dismissable_alert' ] ); |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Registers the dismissable alert. |
| 35 |
* |
| 36 |
* @param string[] $allowed_dismissable_alerts The allowed dismissable alerts. |
| 37 |
* |
| 38 |
* @return string[] The allowed dismissable alerts. |
| 39 |
*/ |
| 40 |
public function register_dismissable_alert( $allowed_dismissable_alerts ) { |
| 41 |
$allowed_dismissable_alerts[] = $this->alert_identifier; |
| 42 |
|
| 43 |
return $allowed_dismissable_alerts; |
| 44 |
} |
| 45 |
} |
| 46 |
|