get_icon()` * * `kadence()->print_icon()` */ class Component implements Component_Interface, Templating_Component_Interface { /** * Gets the unique identifier for the theme component. * * @return string Component slug. */ public function get_slug() : string { return 'icons'; } /** * Adds the action and filter hooks to integrate with WordPress. */ public function initialize() { } /** * Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`. * * @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be * a callable or an array with key 'callable'. This approach is used to reserve the possibility of * adding support for further arguments in the future. */ public function template_tags() : array { return array( 'get_icon' => array( $this, 'get_icon' ), 'print_icon' => array( $this, 'print_icon' ), ); } /** * Get an SVG Icon * * @param string $icon the icon name. * @param string $icon_title the icon title for screen readers. * @param bool $base if the baseline class should be added. */ public function get_icon( $icon = 'search', $icon_title = '', $base = true, $aria = false ) { $display_title = apply_filters( 'kadence_svg_icons_have_title', true ); $output = ''; switch ( $icon ) { case 'moon': $output .= ''; $output = apply_filters( 'kadence_svg_icon', $output, $icon, $icon_title, $base ); return $output; } /** * Print an SVG Icon * * @param string $icon the icon name. * @param string $icon_title the icon title for screen readers. * @param bool $base if the baseline class should be added. */ public function print_icon( $icon = 'search', $icon_title = '', $base = true ) { echo $this->get_icon( $icon, $icon_title, $base ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } }