mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Added icon wrapper class
This commit is contained in:
parent
9fb44d0789
commit
fda7c99c73
@ -7,5 +7,7 @@ HumHub Change Log (DEVELOP)
|
||||
|
||||
- Enh: GroupPermissionManager - allow to query users by given permission
|
||||
- Enh: Automatic migrate DB collations from utf8 to utf8mb4
|
||||
- Enh: Added Icon widget as wrapper class
|
||||
|
||||
|
||||
|
||||
|
55
protected/humhub/modules/ui/widgets/Icon.php
Normal file
55
protected/humhub/modules/ui/widgets/Icon.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\modules\ui\widgets;
|
||||
|
||||
use humhub\components\Widget;
|
||||
|
||||
/**
|
||||
* Class Icon
|
||||
*
|
||||
* Wrapper class for icon handling.
|
||||
* Currently this class only supports FontAwesome 4.7 icons
|
||||
*
|
||||
* @since 1.4
|
||||
* @package humhub\modules\ui\widgets
|
||||
*/
|
||||
class Icon extends Widget
|
||||
{
|
||||
/**
|
||||
* @var string the name/id of the icon
|
||||
*/
|
||||
public $name;
|
||||
|
||||
|
||||
/**
|
||||
* @return string returns the Html tag for the current icon
|
||||
*/
|
||||
public function renderHtml()
|
||||
{
|
||||
return '<i class="fa fa-' . $this->name . '"></i>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
return $this->renderHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string returns the Html tag for this icon
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->renderHtml();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user