ACF_Admin_Notice{}└─ ACF_Data
Хуков нет.
Использование
$ACF_Admin_Notice = new ACF_Admin_Notice(); // use class methods
Методы
- public render()
Код ACF_Admin_Notice{} ACF Admin Notice{} ACF 6.4.2
class ACF_Admin_Notice extends ACF_Data {
/** @var array Storage for data. */
var $data = array(
/** @type string Text displayed in notice. */
'text' => '',
/** @type string The type of notice (warning, error, success, info). */
'type' => 'info',
/** @type bool If the notice can be dismissed. */
'dismissible' => true,
/** @type bool If the dismissed state should be persisted to ACF user preferences. */
'persisted' => false,
);
/**
* render
*
* Renders the notice HTML.
*
* @date 27/12/18
* @since 5.8.0
*
* @param void
* @return void
*/
function render() {
$notice_text = $this->get( 'text' );
$notice_type = $this->get( 'type' );
$is_dismissible = $this->get( 'dismissible' );
$is_persisted = $this->get( 'persisted' );
printf(
'<div class="acf-admin-notice notice notice-%s %s" data-persisted="%s" data-persist-id="%s">%s</div>',
esc_attr( $notice_type ),
$is_dismissible ? 'is-dismissible' : '',
$is_persisted ? 'true' : 'false',
esc_attr( md5( $notice_text ) ),
acf_esc_html( wpautop( acf_punctify( $notice_text ) ) )
);
}
}