%2$s',
esc_attr( $text ),
esc_html( $text )
);
}
/** The same icon as a string, for markup built with concatenation. */
public static function markup( $text ) {
ob_start();
self::render( $text );
return (string) ob_get_clean();
}
/**
* A tag beside a setting or a step: "Required" — without it customers
* cannot find or send the form — or "Recommended" — the form works, but
* something is missing (N-124). Written out, not only coloured.
*
* @param string $kind 'required' or 'recommended'.
*/
public static function tag( $kind ) {
echo wp_kses( self::tag_markup( $kind ), array( 'span' => array( 'class' => true ) ) );
}
/**
* The same tag as a string.
*
* @param string $kind 'required' or 'recommended'.
* @return string
*/
public static function tag_markup( $kind ) {
$required = 'required' === $kind;
return sprintf(
' %2$s',
$required ? 'required' : 'recommended',
$required ? esc_html__( 'Required', 'careback' ) : esc_html__( 'Recommended', 'careback' )
);
}
/**
* The icon's stylesheet and placement script (assets/css/admin.css,
* assets/js/admin.js), enqueued: every tab of the plugin's screen loads them
* already (Admin::assets()); a screen elsewhere that draws an icon asks for
* them here, before its header is printed.
*/
public static function assets() {
wp_enqueue_style( 'careback-admin', CAREBACK_URL . 'assets/css/admin.css', array( 'dashicons' ), CAREBACK_VERSION );
wp_enqueue_script( 'careback-admin', CAREBACK_URL . 'assets/js/admin.js', array(), CAREBACK_VERSION, true );
}
}