getIconMap example

public function getIcon($width = 125, $height = 150, $stroke_width = NULL, $padding = NULL) {
    $icon = [];
    if ($icon_path = $this->getIconPath()) {
      $icon = [
        '#theme' => 'image',
        '#uri' => $icon_path,
        '#width' => $width,
        '#height' => $height,
        '#alt' => $this->getLabel(),
      ];
    }
    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);
      }
      
Home | Imprint | This part of the site doesn't use cookies.