*/ private static $handlers = array(); /** * Registers a facet type handler class. * * @param string $type Unique facet type slug. * @param string $class Fully-qualified class name implementing Facet_Handler_Interface. */ public static function register( $type, $class ) { self::$handlers[ sanitize_key( $type ) ] = $class; } /** * Returns registered facet handlers. * * @return array */ public static function get_handlers() { self::ensure_defaults(); return self::$handlers; } /** * Renders all configured facets for a grid. * * @param array $facets Array of facet configurations. * @param int $grid_id Grid ID. * @param array $runtime_params Runtime parameters. * @param bool $is_preview True if preview rendering. * @param array $layout Optional layout settings (for drawer/sidebar controls). * @return string HTML. */ public static function render_facets( $facets, $grid_id, $runtime_params = array(), $is_preview = false, $layout = array() ) { self::ensure_defaults(); if ( empty( $facets ) || ! is_array( $facets ) ) { return ''; } $filter_pos = ! empty( $layout['filter_position'] ) ? sanitize_key( $layout['filter_position'] ) : 'top'; $is_drawer = in_array( $filter_pos, array( 'left_sidebar', 'right_sidebar', 'drawer' ), true ); $drawer_title = ! empty( $layout['drawer_button_label'] ) ? sanitize_text_field( $layout['drawer_button_label'] ) : __( 'Filters', 'ajax-filter-posts' ); ob_start(); ?>