__( 'Chevron', 'akava-back-to-top' ), 'arrow' => __( 'Arrow', 'akava-back-to-top' ), 'double' => __( 'Double chevron', 'akava-back-to-top' ), 'minimal' => __( 'Minimal', 'akava-back-to-top' ), 'bar-arrow' => __( 'Arrow to line', 'akava-back-to-top' ), 'caret' => __( 'Caret', 'akava-back-to-top' ), 'triangle' => __( 'Triangle', 'akava-back-to-top' ), 'north' => __( 'North arrow', 'akava-back-to-top' ), 'rocket' => __( 'Rocket', 'akava-back-to-top' ), 'page-top' => __( 'Page top', 'akava-back-to-top' ), ); } /** * Render a bundled SVG or a validated WordPress image attachment. * * Uploaded SVG remains an external image. It is never injected as inline XML. * * @param string $type Icon type. * @param int $attachment_id Optional attachment ID. * @return string */ public static function render( $type, $attachment_id = 0 ) { if ( 'custom' === $type && $attachment_id ) { $url = wp_get_attachment_image_url( $attachment_id, 'thumbnail' ); $url = $url ? $url : wp_get_attachment_url( $attachment_id ); if ( $url ) { return ''; } } $paths = self::paths(); $path = isset( $paths[ $type ] ) ? $paths[ $type ] : $paths['chevron']; return ''; } /** * Render the dedicated ReturnPoint icon. * * A separate bundled icon avoids rotating an uploaded logo or custom artwork. * * @return string */ public static function render_return() { return self::render( 'return' ); } /** * Bundled stroke-only paths. * * @return array */ private static function paths() { return array( 'chevron' => '', 'arrow' => '', 'double' => '', 'minimal' => '', 'bar-arrow' => '', 'caret' => '', 'triangle' => '', 'north' => '', 'rocket' => '', 'page-top' => '', 'return' => '', ); } }