diff --git a/core/lib/Drupal/Core/Layout/IconGenerator.php b/core/lib/Drupal/Core/Layout/IconGenerator.php index 621672d..be36b20 100644 --- a/core/lib/Drupal/Core/Layout/IconGenerator.php +++ b/core/lib/Drupal/Core/Layout/IconGenerator.php @@ -10,7 +10,32 @@ class IconGenerator implements IconGeneratorInterface { /** * {@inheritdoc} */ - public function generateSvg(array $regions, $width, $height, $stroke_width, $fill, $stroke) { + public function generateSvgFromIconMap(array $icon_map, $width, $height, $stroke_width, $padding, $fill, $stroke) { + $regions = $this->calculateSvgValues($icon_map, $width, $height, $stroke_width, $padding); + return $this->generateSvg($regions, $width, $height, $stroke_width, $fill, $stroke); + } + + /** + * Generates an SVG. + * + * @param mixed[] $regions + * An array keyed by region name, with each element containing the 'height', + * 'width', and 'x' and 'y' offsets of each region. + * @param int $width + * The width of the generated SVG. + * @param int $height + * The height of the generated SVG. + * @param int $stroke_width + * The width of region borders. + * @param string $fill + * The fill color of regions. + * @param string $stroke + * The color of region borders. + * + * @return array + * A render array representing a SVG icon. + */ + protected function generateSvg(array $regions, $width, $height, $stroke_width, $fill, $stroke) { $build = [ '#type' => 'html_tag', '#tag' => 'svg', @@ -54,15 +79,6 @@ public function generateSvg(array $regions, $width, $height, $stroke_width, $fil } /** - * {@inheritdoc} - */ - public function generateSvgFromIconMap(array $icon_map, $width, $height, $stroke_width, $padding, $fill, $stroke) { - $regions = $this->calculateSvgValues($icon_map, $width, $height, $stroke_width, $padding); - return $this->generateSvg($regions, $width, $height, $stroke_width, $fill, $stroke); - - } - - /** * Calculates the dimensions and offsets of all regions. * * @param array $rows diff --git a/core/lib/Drupal/Core/Layout/IconGeneratorInterface.php b/core/lib/Drupal/Core/Layout/IconGeneratorInterface.php index 56777f9..38cd949 100644 --- a/core/lib/Drupal/Core/Layout/IconGeneratorInterface.php +++ b/core/lib/Drupal/Core/Layout/IconGeneratorInterface.php @@ -19,17 +19,17 @@ * | | * |-------|--------------|-------| * | | | | - * | 25% | 50% | 25% | + * | | 50% | 25% | * | | | | - * |-------|--------------|-------| - * | | - * | 100% | - * | | + * | 25% |--------------|-------| + * | | | + * | | 75% | + * | | | * |------------------------------| * The corresponding array would be: * - [top] * - [first, second, second, third] - * - [bottom]. + * - [first, bottom, bottom, bottom]. * @param int $width * The width of the generated SVG. * @param int $height @@ -48,26 +48,4 @@ */ public function generateSvgFromIconMap(array $icon_map, $width, $height, $stroke_width, $padding, $fill, $stroke); - /** - * Generates an SVG. - * - * @param mixed[] $regions - * An array keyed by region name, with each element containing the 'height', - * 'width', and 'x' and 'y' offsets of each region. - * @param int $width - * The width of the generated SVG. - * @param int $height - * The height of the generated SVG. - * @param int $stroke_width - * The width of region borders. - * @param string $fill - * The fill color of regions. - * @param string $stroke - * The color of region borders. - * - * @return array - * A render array representing a SVG icon. - */ - public function generateSvg(array $regions, $width, $height, $stroke_width, $fill, $stroke); - }