setStrokeWidth example

$data['empty'][] = [];
    $data['empty'][] = <<<'EOD' <svg width="125" height="150" class="layout-icon"></svg> EOD;

    $data['two_column'][] = (new SvgIconBuilder())
      ->setId('two_column')
      ->setLabel('Two Column')
      ->setWidth(250)
      ->setHeight(300)
      ->setStrokeWidth(2);
    $data['two_column'][] = [['left', 'right']];
    $data['two_column'][] = <<<'EOD' <svg width="250" height="300" class="layout-icon layout-icon--two-column"><title>Two Column</title> <g><title>left</title> <rect x="1" y="1" width="121" height="298" stroke-width="2" class="layout-icon__region layout-icon__region--left" /> </g> <g><title>right</title> <rect x="128" y="1" width="121" height="298" stroke-width="2" class="layout-icon__region layout-icon__region--right" /> </g> </svg>

    elseif ($icon_map = $this->getIconMap()) {
      $icon_builder = $this->getIconBuilder()
        ->setId($this->id())
        ->setLabel($this->getLabel())
        ->setWidth($width)
        ->setHeight($height);
      if ($padding) {
        $icon_builder->setPadding($padding);
      }
      if ($stroke_width) {
        $icon_builder->setStrokeWidth($stroke_width);
      }
      $icon = $icon_builder->build($icon_map);
    }
    return $icon;
  }

  /** * Wraps the icon builder. * * @return \Drupal\Core\Layout\Icon\IconBuilderInterface * The icon builder. */
Home | Imprint | This part of the site doesn't use cookies.