Changeset 45814
- Timestamp:
- 08/15/2019 11:00:38 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r45737 r45814 1686 1686 * 1687 1687 * @since 3.0.0 1688 * @since 5.3.0 Added `warning` and `info` as possible values for `$type`. 1688 1689 * 1689 1690 * @global array $wp_settings_errors Storage array of errors registered during this pageload … … 1693 1694 * @param string $message The formatted message text to display to the user (will be shown inside styled 1694 1695 * `<div>` and `<p>` tags). 1695 * @param string $type Optional. Message type, controls HTML class. Accepts 'error' or 'updated'.1696 * Default 'error'.1696 * @param string $type Optional. Message type, controls HTML class. Possible values include 'error', 1697 * 'success', 'warning', 'info'. Default 'error'. 1697 1698 */ 1698 1699 function add_settings_error( $setting, $code, $message, $type = 'error' ) { … … 1788 1789 * 1789 1790 * @since 3.0.0 1791 * @since 5.3.0 Legacy `error` and `updated` CSS classes are mapped to 1792 * `notice-error` and `notice-success`. 1790 1793 * 1791 1794 * @param string $setting Optional slug title of a specific setting whose errors you want. … … 1808 1811 $output = ''; 1809 1812 foreach ( $settings_errors as $key => $details ) { 1810 $css_id = 'setting-error-' . $details['code']; 1811 $css_class = $details['type'] . ' settings-error notice is-dismissible'; 1812 $output .= "<div id='$css_id' class='$css_class'> \n"; 1813 $output .= "<p><strong>{$details['message']}</strong></p>"; 1814 $output .= "</div> \n"; 1813 if ( 'updated' === $details['type'] ) { 1814 $details['type'] = 'success'; 1815 } 1816 1817 $css_id = sprintf( 1818 'setting-error-%s', 1819 sanitize_html_class( $details['code'] ) 1820 ); 1821 $css_class = sprintf( 1822 'notice notice-%s settings-error is-dismissible', 1823 sanitize_html_class( $details['type'] ) 1824 ); 1825 1826 $output .= "<div id='$css_id' class='$css_class'> \n"; 1827 $output .= "<p><strong>{$details['message']}</strong></p>"; 1828 $output .= "</div> \n"; 1815 1829 } 1816 1830 echo $output;
Note: See TracChangeset
for help on using the changeset viewer.