Class KindIcon

java.lang.Object
io.jenkins.plugins.batchcontrol.ui.KindIcon

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class KindIcon extends Object
D-71 (spec-review-S6 M-1): an item kind's icon as markup, for answers that are built in Java rather than in Jelly (the request form's item check, FormValidation.okWithMarkup). The lists and the detail page render the same icon with l:icon (tags/scopeItem.jelly).

Core's l:icon turns a symbol-<name> [plugin-<id>] icon class into an inline SVG through Symbol.get(SymbolRequest); this does the same through the same public API (the IconSet and Functions shortcuts that l:icon uses are NoExternalUse). The SVG comes from core's or the plugin's own symbol resources; Symbol empties its <title> and marks it aria-hidden, so the icon adds no text and the kind's display name next to it stays the accessible name.

The icon class is a descriptor's getIconClassName(), never user input. It is still checked against a strict pattern before it reaches the resource lookup, and anything else (a legacy icon-* class, a bitmap path) yields no icon: the icon is decoration, the display name carries the meaning.

  • Method Details

    • svg

      public static String svg(@CheckForNull String iconClassName, String classes)
      The inline SVG of iconClassName with the CSS classes classes, or an empty string when the class is not a symbol or the symbol cannot be rendered.
      Parameters:
      iconClassName - a descriptor's icon class, for example symbol-freestyle-project or symbol-folder-outline plugin-ionicons-api
      classes - CSS classes for the svg element (a constant of the caller, such as icon-sm)