クラス
Snackbar
Snackbar React component for broadcasting messages
ソース ソース
ファイル: src/Views/Snackbar/Snackbar.php
class Snackbar { /** * Registers hooks * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public static function init() { add_action('wp_footer', [get_class(), 'addSnackbarToFooter']); } /** * Loads Snackbar component * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param array $deps optional dependencies * @return void */ public static function load(array $deps = []) { $assetsmap = include(WCEXWL_PLUGIN_DIR . '/dist/js/Views/Snackbar/App.asset.php'); wp_enqueue_script( 'wcexwl-snackbar', WCEXWL_PLUGIN_URL . '/dist/js/Views/Snackbar/App.js', array_merge($assetsmap['dependencies'], $deps), $assetsmap['version'], true ); } /** * Adds React snackbar component mount node to footer * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public static function addSnackbarToFooter() { ?> <div id="<?php echo Master::REACT_DOM_NODE ?>" class="wcexwl"></div> <?php } }
- addSnackbarToFooter — Adds React snackbar component mount node to footer
- init — Registers hooks
- load — Loads Snackbar component