inner SVG markup (the path/line/etc. children). * * Each entry is the inner contents only; the outer wrapper is added * by the lucide() method so common attributes stay consistent. * * Source: https://lucide.dev (ISC License) * * @return array */ private static function paths(): array { return [ 'refresh-cw' => '', 'trash-2' => '', 'download' => '', 'copy' => '', 'check' => '', 'x' => '', 'wrench' => '', 'settings' => '', 'upload' => '', 'key' => '', 'chevron-left' => '', 'chevron-right' => '', 'mail' => '', 'network' => '', 'filter' => '', 'clock' => '', 'list' => '', 'file-text' => '', 'file' => '', 'eye' => '', 'eye-off' => '', 'lock' => '', 'pencil' => '', 'grip-vertical' => '', 'grip-horizontal' => '', 'image' => '', 'external-link' => '', 'circle-check' => '', 'triangle-alert' => '', 'circle-help' => '', 'info' => '', 'menu' => '', 'search' => '', 'plus' => '', 'align-justify' => '', 'play' => '', 'pause' => '', 'puzzle' => '', 'users' => '', 'globe' => '', 'calendar' => '', 'music' => '', 'video' => '', 'archive' => '', 'code' => '', 'table' => '', 'star' => '', ]; } /** * Render a Lucide icon as inline SVG markup. * * @param string $name Icon name (must exist in self::paths()). * @param array $attributes Optional extra attributes to merge onto the . * Supported keys: class, data-state, aria-label. * * @return string Safe-to-echo SVG markup, or empty string if the icon is unknown. */ public static function lucide( string $name, array $attributes = [] ): string { $paths = self::paths(); if( !isset( $paths[ $name ] ) ) { return ''; } $class = 'ae-icon'; if( !empty( $attributes['class'] ) ) { $class .= ' ' . sanitize_html_class( $attributes['class'], '' ); } $data_state = ''; if( !empty( $attributes['data-state'] ) ) { $data_state = ' data-state="' . esc_attr( $attributes['data-state'] ) . '"'; } $aria = ' aria-hidden="true"'; if( !empty( $attributes['aria-label'] ) ) { $aria = ' role="img" aria-label="' . esc_attr( $attributes['aria-label'] ) . '"'; } return sprintf( '%4$s', esc_attr( $class ), $data_state, $aria, $paths[ $name ] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static, controlled SVG markup with no user input. ); } }