IconBuilderInterface.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace Drupal\Core\Layout\Icon;
  3. /**
  4. * Provides an interface for building layout icons.
  5. */
  6. interface IconBuilderInterface {
  7. /**
  8. * Builds a render array representation of an SVG based on an icon map.
  9. *
  10. * @param string[][] $icon_map
  11. * A two-dimensional array representing the visual output of the layout.
  12. * For the following shape:
  13. * |------------------------------|
  14. * | |
  15. * | 100% |
  16. * | |
  17. * |-------|--------------|-------|
  18. * | | | |
  19. * | | 50% | 25% |
  20. * | | | |
  21. * | 25% |--------------|-------|
  22. * | | |
  23. * | | 75% |
  24. * | | |
  25. * |------------------------------|
  26. * The corresponding array would be:
  27. * - ['top']
  28. * - ['first', 'second', 'second', 'third']
  29. * - ['first', 'bottom', 'bottom', 'bottom'].
  30. *
  31. * @return array
  32. * A render array representing a SVG icon.
  33. */
  34. public function build(array $icon_map);
  35. /**
  36. * Sets the ID.
  37. *
  38. * @param string $id
  39. * The machine name of the layout.
  40. *
  41. * @return $this
  42. */
  43. public function setId($id);
  44. /**
  45. * Sets the label.
  46. *
  47. * @param string $label
  48. * The label of the layout.
  49. *
  50. * @return $this
  51. */
  52. public function setLabel($label);
  53. /**
  54. * Sets the width.
  55. *
  56. * @param int $width
  57. * The width of the SVG.
  58. *
  59. * @return $this
  60. */
  61. public function setWidth($width);
  62. /**
  63. * Sets the height.
  64. *
  65. * @param int $height
  66. * The height of the SVG.
  67. *
  68. * @return $this
  69. */
  70. public function setHeight($height);
  71. /**
  72. * Sets the padding.
  73. *
  74. * @param int $padding
  75. * The padding between regions.
  76. *
  77. * @return $this
  78. */
  79. public function setPadding($padding);
  80. /**
  81. * Sets the stroke width.
  82. *
  83. * @param int|null $stroke_width
  84. * The width of region borders.
  85. *
  86. * @return $this
  87. */
  88. public function setStrokeWidth($stroke_width);
  89. }