Sets icon for button.

@param string $icon Icon CSS class

@return $this

@todo Implement this trough Icon view
512082
public function setIcon($icon)
    {
        if ($icon[0] != '<') {
            $icon = '<i class="icon-'.$icon.'"></i>';
        }
        $this->template->trySetHTML('icon', $icon);

        return $this;
    }
11407
public function setRightIcon($icon) {
    $this->rightIcon = $icon;
    $this->widgetOptions['icons']['secondary'] = 'ui-icon-'.$this->rightIcon;
    return $this;
  }
178665
public function icon($icon, $icon2 = null)
    {
        $this->icon = trim($icon);

        if (! str_empty($icon2)) {
            $this->icon2 = trim($icon2);
        }

        return $this;
    }
428801
public static function createIcon(string $icon, array $arguments = null) {
		$element = Html::el("i");
		
		if($icon == "b" or $icon == "l" or $icon == "s" or $icon == "r") {
			// Markup of icon which use Font Awesome 5.
			$class = ["fa".$icon];
		} else {
			// Markup of icon which use Font Awesome 4.
			$class = ["fa fa-".$icon];
		}
		
		if(isset($arguments)) {
			foreach($arguments as $argument) {
				$class[] = "fa-".$argument;
			}
		}
		
		$element->addAttributes(["class" => $class, "aria-hidden" => "true"]);
		return $element;
	}
1257798
public function thumbnail($icon, $icon2 = null, $width = null, $height = null)
    {
        $this->thumbnail = trim($icon);

        if (! str_empty($icon2)) {
            $this->thumbnail2 = trim($icon2);
        }

        if (! is_null($width)) {
            $this->thumbnailWidth = $width;
        }

        if (! is_null($height)) {
            $this->thumbnailHeight = $height;
        }

        return $this;
    }
1042315
public function setLabel($label)
    {
        if (is_array($label) && $label['icon']) {
            $this->setIcon($label['icon']);
        } elseif (is_string($label)) {
            return $this->setText($label);
        }

        return $this;
    }
282731
public function icon($icon = null)
    {
        if ($icon === null) {
            return $this->_icon;
        }
        $this->_icon = $icon;

        return $this;
    }
109546
public function setClass($iconClass)
    {
        $this->attributes->removeAttributeClass(['fa', 'fa-*']);
        $this->attributes->addAttributeClass($iconClass);

        return $this;
    }
714957
public function iconFunction($icon, $iconSet = 'icon')
    {
        if ($iconSet == 'icon') {
            $iconSet = $this->iconPrefix;
        }
        $icon = str_replace('+', ' '.$iconSet.'-', $icon);

        return sprintf('<%1$s class="%2$s %2$s-%3$s"></%1$s>', $this->iconTag, $iconSet, $icon);
    }
1346143
@NonNull
    public IconicsDrawable icon(@NonNull String icon) {
        try {
            ITypeface font = Iconics.findFont(mContext, icon.substring(0, 3));
            icon = icon.replace("-", "_");
            icon(font.getIcon(icon));
        } catch (Exception ex) {
            Log.e(Iconics.TAG, "Wrong icon name: " + icon);
        }
        return this;
    }
1359033
public function addIcons($icons){
		foreach ( $this->content as $index=>$item ) {
			if($item instanceof HtmlButton && isset($icons[$index]))
				$item->addIcon($icons[$index]);
		}
		return $this;
	}
875525
public function on($icon, array $classes = array(), $style='fas')
    {
        if (is_string($icon) === false) {
            throw new \InvalidArgumentException(
                'Icon label must be a string.'
            );
        }
        if (is_string($style) === false) {
            throw new \InvalidArgumentException(
                'The style label must be a string.'
            );
        }
        if (!in_array($style, $this->STYLES)) {
            throw new \InvalidArgumentException(
                'Invalid style.'
            );
        }

        $iconClasses = $icon . ' fa-stack-1x';

        if (count($classes) > 0) {
            foreach ($classes as $class) {
                $iconClasses .= ' ' . $this->classMapper($class);
            }
        }

        $this->bottomIcon = sprintf(self::ICON_HTML, $style, $iconClasses);

        return $this;
    }
944012
public function setIcon($icon)
    {
        switch ($icon) {
            case 'info':
            case 'error':
            case 'warning':
                $this->icon = $icon;
                break;
            default:
                if (file_exists($icon) && is_file($icon)) {
                    $this->icon = $icon;
                } else {
                    if (isset($this->log)) {
                        $this->log(
                            sprintf(
                                "%s is not a file. Using default icon instead.",
                                $icon
                            ),
                            Project::MSG_WARN
                        );
                    }
                }
        }
    }
984881
def set_icon(self, icon):
        ''''''
        self._icon = icon
        return self._listitem.setIconImage(icon)
1186054
public function setIcon($icon)
    {
        $this->icon = $icon;

        $type = mb_substr($icon, 0, 1) === ':' && mb_substr($icon, -1) === ':'
            ? 'iconEmoji'
            : 'iconUrl';

        $this->$type = $icon;

        return $this;
    }
704087
public function from($username, $icon = null)
    {
        $this->username = $username;

        if (! is_null($icon)) {
            $this->icon = $icon;
        }

        return $this;
    }
1101920
public function setFooter($text, $icon = null)
    {
        $this->data['footer'] = $text;
        if ($icon) {
            $this->data['footer_icon'] = $icon;
        }

        return $this;
    }