Set menu icon

Use this function to set the menu icon in the admin dashboard. Since WordPress v3.8
dashicons are used. For more information see @link http://melchoyce.github.io/dashicons/

@param string $icon dashicon name
512491
function menu_icon( $icon = "dashicons-admin-page" ) {

        if ( is_string( $icon ) && stripos( $icon, "dashicons" ) !== false ) {

            $this->options["menu_icon"] = $icon;

        } else {

            // Set a default menu icon
            $this->options["menu_icon"] = "dashicons-admin-page";
        }
    }
578532
protected function render_pix_icon(pix_icon $icon) {
        $system = \core\output\icon_system::instance();
        return $system->render_pix_icon($this, $icon);
    }
1349504
public void setIcon(final Image IMAGE) {
        if (null == icon) {
            _icon = IMAGE;
            fireSectionEvent(UPDATE_EVENT);
        } else {
            icon.set(IMAGE);
        }
    }
637446
public function setIcon(?string $icon): self
    {
        if (null === $icon) {
            $this->icon = $this->iconType = null;

            return $this;
        }

        if (':' === \mb_substr($icon, 0, 1) && ':' === \mb_substr($icon, \mb_strlen($icon) - 1, 1)) {
            $this->iconType = self::ICON_TYPE_EMOJI;
        } else {
            $this->iconType = self::ICON_TYPE_URL;
        }

        $this->icon = $icon;

        return $this;
    }
1369639
public void setIcon(FontOpenCms icon, String color) {

        if (icon != null) {
            m_iconCell.setInnerHTML(icon.getHtml(32, color));
        } else {
            m_iconCell.setInnerHTML("");
        }
    }
1069082
public function addonIcon($icon, $options = [])
    {
        $prefix = array_get($options, 'prefix', $this->getIconPrefix());

        return '<div class="input-group-addon"><span ' . $this->html->attributes($options) . '><i class="'.$prefix.$icon.'"></i></span></div>';
    }
146238
public function addIcon($row, $label, DataContainer $dc, $args)
  {
    $image = 'file_type_sets';
    
    if (!$row['published'])
    {
      $image .= '_';
    }
    
    $args[0] = sprintf('<div class="list_icon_new" style="background-image:url(\'system/modules/DocumentManagementSystemFileTypeSets/assets/%s.png\'); height: 16px;" data-icon="system/modules/DocumentManagementSystemFileTypeSets/assets/%s.png" data-icon-disabled="system/modules/DocumentManagementSystemFileTypeSets/assets/%s.png">&nbsp;</div>', $image, rtrim($image, '_'), rtrim($image, '_') . '_');
    
    $args[2] = \ContaoDMS\DmsUtils::getCuttedAllowedFileTypes($row['file_types']);
    
    return $args;
  }
714693
public void setIcon(String icon) {

        m_icon = icon;
        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_ICON_1, icon));
        }
    }
240265
public function setIconPosition($iconPosition)
    {
        switch ($iconPosition) {
            case self::ICON_PREPEND:
            case self::ICON_APPEND:
                $this->iconPosition = $iconPosition;
                break;
            default:
                throw new Exception\InvalidArgumentException('Invalid icon position given');
        }
        return $this;
    }
1211686
public function setIcon($icon)
    {
        if ($icon instanceof Icon) {
            $this->icon = $icon;
        } else {
            $this->icon = new Icon($icon);
        }

        return $this;
    }
984881
def set_icon(self, icon):
        ''''''
        self._icon = icon
        return self._listitem.setIconImage(icon)
506661
protected function setIcon($actions, $num = 1)
    {
        foreach ($actions as $key=>$moudel){
            if(isset($moudel['actions'])){
                $actions[$key]['iconClose'] = $this->request->root()."/apidoc/js/zTree_v3/img/zt-folder.png";
                $actions[$key]['iconOpen'] = $this->request->root()."/apidoc/js/zTree_v3/img/zt-folder-o.png";
                $actions[$key]['open'] = true;
                $actions[$key]['isParent'] = true;
                $actions[$key]['actions'] = $this->setIcon($moudel['actions'], $num = 1);
            }else{
                $actions[$key]['icon'] = $this->request->root()."/apidoc/js/zTree_v3/img/zt-file.png";
                $actions[$key]['isParent'] = false;
                $actions[$key]['isText'] = true;
            }
        }
        return $actions;
    }
82638
protected function iconExists($icon)
    {
        foreach ($this->icons as $group) {
            foreach ($group as $entry) {
                if (!is_array($entry)) {
                    continue;
                }

                if ($entry['value'] === $icon) {
                    return true;
                }
            }
        }

        return false;
    }
90524
public static function _add_icon( $title, $id ) {
		$meta = Menu_Icons_Meta::get( $id );
		$icon = self::get_icon( $meta );

		if ( empty( $icon ) ) {
			return $title;
		}

		$title_class   = ! empty( $meta['hide_label'] ) ? self::$hidden_label_class : '';
		$title_wrapped = sprintf(
			'<span%s>%s</span>',
			( ! empty( $title_class ) ) ? sprintf( ' class="%s"', esc_attr( $title_class ) ) : '',
			$title
		);

		if ( 'after' === $meta['position'] ) {
			$title_with_icon = "{$title_wrapped}{$icon}";
		} else {
			$title_with_icon = "{$icon}{$title_wrapped}";
		}

		/**
		 * Allow plugins/themes to override menu item markup
		 *
		 * @since 0.8.0
		 *
		 * @param string  $title_with_icon Menu item markup after the icon is added.
		 * @param integer $id              Menu item ID.
		 * @param array   $meta            Menu item metadata values.
		 * @param string  $title           Original menu item title.
		 *
		 * @return string
		 */
		$title_with_icon = apply_filters( 'menu_icons_item_title', $title_with_icon, $id, $meta, $title );

		return $title_with_icon;
	}
1358194
private function createHeaderLinkIcon($column)
    {
        $class = $this->filter->isSortedByDesc($column) ? $this->options['arrowDownIcon'] : $this->options['arrowUpIcon'];
        return $this->createIcon($class);
    }
688856
public function initialize($name = "Unknown", $icon = null){
        if($this->em->getRepository(PageType::class)->findOneByTitle($name) === null){
            $type = new PageType();
            $type->setTitle($name);
            $type->setIcon($icon);
            $this->em->persist($type);
            $this->em->flush();
        }
    }
743008
public function setDisplayIcon( $displayIcon )
    {
        if ( empty( $displayIcon ) )
        {
            $displayIcon = array();
        }
        else if ( $displayIcon instanceof Traversable )
        {
            $displayIcon = ArrayUtils::iteratorToArray( $displayIcon );
        }
        else if ( ! is_array( $displayIcon ) )
        {
            $displayIcon = (array) $displayIcon;
        }

        $this->displayIcon = $displayIcon;
        return $this;
    }