init_hooks(); } /** * Get the single instance of the Category class. * * @since 1.0.0 * @access public * * @return Category The single instance. */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Initialize WordPress hooks. * * @since 1.0.0 * @access private * * @return void */ private function init_hooks() { add_filter( 'block_categories_all', array( $this, 'register_category' ), 10, 2 ); } /** * Register the Acumenpopup block category. * * Adds the Acumenpopup category to the beginning of the categories list. * * @since 1.0.0 * @access public * * @param array $categories Array of existing block categories. * @param \WP_Block_Editor_Context $context The block editor context. * * @return array Modified array with Acumenpopup category added. */ public function register_category( $categories, $context = null ) { return array_merge( array( array( 'slug' => $this->category_slug, 'title' => esc_html__( 'Acumenpopup Blocks', 'acumen-popup' ), 'icon' => null, ), ), $categories ); } /** * Get the category slug. * * @since 1.0.0 * @access public * * @return string The category slug. */ public function get_category_slug() { return $this->category_slug; } /** * Prevent cloning of the instance. * * @since 1.0.0 * @access public * * @return void */ public function __clone() { _doing_it_wrong( __FUNCTION__, esc_html__( 'Cloning is forbidden.', 'acumen-popup' ), '1.0.0' ); } /** * Prevent unserializing of the instance. * * @since 1.0.0 * @access public * * @return void */ public function __wakeup() { _doing_it_wrong( __FUNCTION__, esc_html__( 'Unserializing is forbidden.', 'acumen-popup' ), '1.0.0' ); } }