You are here

interface IconBuilderInterface in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Layout/Icon/IconBuilderInterface.php \Drupal\Core\Layout\Icon\IconBuilderInterface
  2. 9 core/lib/Drupal/Core/Layout/Icon/IconBuilderInterface.php \Drupal\Core\Layout\Icon\IconBuilderInterface

Provides an interface for building layout icons.

Hierarchy

Expanded class hierarchy of IconBuilderInterface

All classes that implement IconBuilderInterface

File

core/lib/Drupal/Core/Layout/Icon/IconBuilderInterface.php, line 8

Namespace

Drupal\Core\Layout\Icon
View source
interface IconBuilderInterface {

  /**
   * Builds a render array representation of an SVG based on an icon map.
   *
   * @param string[][] $icon_map
   *   A two-dimensional array representing the visual output of the layout.
   *   For the following shape:
   *   |------------------------------|
   *   |                              |
   *   |             100%             |
   *   |                              |
   *   |-------|--------------|-------|
   *   |       |              |       |
   *   |       |      50%     |  25%  |
   *   |       |              |       |
   *   |  25%  |--------------|-------|
   *   |       |                      |
   *   |       |         75%          |
   *   |       |                      |
   *   |------------------------------|
   *   The corresponding array would be:
   *   - ['top']
   *   - ['first', 'second', 'second', 'third']
   *   - ['first', 'bottom', 'bottom', 'bottom'].
   *
   * @return array
   *   A render array representing a SVG icon.
   */
  public function build(array $icon_map);

  /**
   * Sets the ID.
   *
   * @param string $id
   *   The machine name of the layout.
   *
   * @return $this
   */
  public function setId($id);

  /**
   * Sets the label.
   *
   * @param string $label
   *   The label of the layout.
   *
   * @return $this
   */
  public function setLabel($label);

  /**
   * Sets the width.
   *
   * @param int $width
   *   The width of the SVG.
   *
   * @return $this
   */
  public function setWidth($width);

  /**
   * Sets the height.
   *
   * @param int $height
   *   The height of the SVG.
   *
   * @return $this
   */
  public function setHeight($height);

  /**
   * Sets the padding.
   *
   * @param int $padding
   *   The padding between regions.
   *
   * @return $this
   */
  public function setPadding($padding);

  /**
   * Sets the stroke width.
   *
   * @param int|null $stroke_width
   *   The width of region borders.
   *
   * @return $this
   */
  public function setStrokeWidth($stroke_width);

}

Members

Namesort descending Modifiers Type Description Overrides
IconBuilderInterface::build public function Builds a render array representation of an SVG based on an icon map. 1
IconBuilderInterface::setHeight public function Sets the height. 1
IconBuilderInterface::setId public function Sets the ID. 1
IconBuilderInterface::setLabel public function Sets the label. 1
IconBuilderInterface::setPadding public function Sets the padding. 1
IconBuilderInterface::setStrokeWidth public function Sets the stroke width. 1
IconBuilderInterface::setWidth public function Sets the width. 1