$atts Shortcode attributes. */ public static function render( $atts = array() ): string { $atts = shortcode_atts( array( 'radius' => '', 'max' => '', 'fuel' => '', 'sort' => '', ), $atts, 'fontdelbosc_combustible' ); wp_enqueue_style( 'fdbc-fuel' ); $data = Fontdelbosc_Combustible_Data_Manager::get_stations( array( 'radius' => $atts['radius'], 'max' => $atts['max'], 'fuel' => $atts['fuel'], 'sort' => $atts['sort'], ) ); return self::view( 'station-list', $data ); } /** * Renders a template by name with the given data. * * @param string $name Template name. * @param array $fontdelbosc_data Template data. */ public static function view( string $name, array $fontdelbosc_data ): string { $file = FONTDELBOSC_COMBUSTIBLE_DIR . 'templates/' . $name . '.php'; if ( ! is_file( $file ) ) { return ''; } ob_start(); include $file; return (string) ob_get_clean(); } }