_yoast_display_notifications()
Create the notifications HTML with restore/dismiss button.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
Строку. The output to render.
Использование
_yoast_display_notifications( $notifications_list, $status );
- $notifications_list(массив) (обязательный)
- List of notifications.
- $status(строка) (обязательный)
- Status of the notifications (active/dismissed).
Код _yoast_display_notifications() yoast display notifications Yoast 27.7
function _yoast_display_notifications( $notifications_list, $status ) {
$notifications = '';
foreach ( $notifications_list as $notification ) {
switch ( $status ) {
case 'active':
$button = sprintf(
'<button type="button" class="button dismiss"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-hidden"></span></button>',
/* translators: Hidden accessibility text. */
esc_html__( 'Hide this item.', 'wordpress-seo' ),
);
break;
case 'dismissed':
$button = sprintf(
'<button type="button" class="button restore"><span class="screen-reader-text">%1$s</span><span class="dashicons yoast-svg-icon-eye"></span></button>',
/* translators: Hidden accessibility text. */
esc_html__( 'Show this item.', 'wordpress-seo' ),
);
break;
}
$notifications .= sprintf(
'<div class="yoast-notification-holder" id="%1$s" data-nonce="%2$s" data-json="%3$s">%4$s%5$s</div>',
esc_attr( $notification->get_id() ),
esc_attr( $notification->get_nonce() ),
esc_attr( $notification->get_json() ),
// This needs to be fixed in https://github.com/Yoast/wordpress-seo-premium/issues/2548.
$notification,
// Note: $button is properly escaped above.
$button,
);
}
return $notifications;
}