IconBuilderInterface.php 2.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
<?php

namespace Drupal\Core\Layout\Icon;

/**
 * Provides an interface for building layout icons.
 */
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);

}