_yoast_display_alerts

Create the alert HTML with restore/dismiss button.

Description

_yoast_display_alerts( (array) $list, (string) $status ); 

Parameters (2)

0. $list (array)
List of alerts.
1. $status (string)
Status of the alerts (active/dismissed).

Usage

  1. if ( !function_exists( '_yoast_display_alerts' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/admin/views/partial-alerts-template.php'; 
  3.  
  4. // List of alerts. 
  5. $list = array(); 
  6.  
  7. // Status of the alerts (active/dismissed). 
  8. $status = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _yoast_display_alerts($list, $status); 
  12.  

Defined (1)

The function is defined in the following location(s).

/admin/views/partial-alerts-template.php  
  1. function _yoast_display_alerts( $list, $status ) { 
  2. foreach ( $list as $notification ) { 
  3.  
  4. switch ( $status ) { 
  5. case 'active': 
  6. $button = sprintf( '<button type="button" class="button dismiss"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-no-alt"></span></button>', __( 'Dismiss this item.', 'wordpress-seo' ) ); 
  7. break; 
  8.  
  9. case 'dismissed': 
  10. $button = sprintf( '<button type="button" class="button restore"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-hidden"></span></button>', __( 'Restore this item.', 'wordpress-seo' ) ); 
  11. break; 
  12.  
  13. printf( '<div class="yoast-alert-holder" id="%1$s" data-nonce="%2$s" data-json="%3$s">%4$s%5$s</div>', $notification->get_id(), $notification->get_nonce(), $notification->get_json(), $notification, $button );