SvgIconBuilder
class SvgIconBuilder implements IconBuilderInterface (View source)
Builds SVG layout icons.
Properties
| protected string | $id | The machine name of the layout. |
|
| protected string | $label | The label of the layout. |
|
| protected int | $width | The width of the SVG. |
|
| protected int | $height | The height of the SVG. |
|
| protected int | $padding | The padding between regions. |
|
| protected int|null | $strokeWidth | The width of region borders. |
Methods
Builds a render array representation of an SVG based on an icon map.
Builds a render array representation of an SVG.
Calculates the dimensions and offsets of all regions.
Gets the offset for this region.
Gets the height or width of a region.
Sets the ID.
Sets the label.
Sets the width.
Sets the height.
Sets the padding.
Sets the stroke width.
Details
array
build(array $icon_map)
Builds a render array representation of an SVG based on an icon map.
protected array
buildRenderArray(array $regions, int $width, int $height, int|null $stroke_width)
Builds a render array representation of an SVG.
protected array[]
calculateSvgValues(array $rows, int $width, int $height, int $stroke_width, int $padding)
Calculates the dimensions and offsets of all regions.
protected int
getOffset(int $delta, int $length, int $stroke_width, int $padding)
Gets the offset for this region.
protected float|int
getLength(int $number_of_regions, int $length, int $stroke_width, int $padding)
Gets the height or width of a region.
$this
setId(string $id)
Sets the ID.
$this
setLabel(string $label)
Sets the label.
$this
setWidth(int $width)
Sets the width.
$this
setHeight(int $height)
Sets the height.
$this
setPadding(int $padding)
Sets the padding.
$this
setStrokeWidth(int|null $stroke_width)
Sets the stroke width.