-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added New Element + Added New Method to VDataTable
- Loading branch information
Showing
3 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace wfc\ui\vuetify; | ||
|
||
/** | ||
* A class that represents a v-icon vuetify element. | ||
* | ||
* @author i.binalshikh | ||
*/ | ||
class VIcon extends \webfiori\ui\HTMLNode { | ||
/** | ||
* Creates new instance of the class. | ||
* | ||
* @param string $icon The name of material design icon. | ||
* | ||
* @param array $iconProps An optional array that holds properties of | ||
* the icon. | ||
*/ | ||
public function __construct(string $icon = 'mdi-information', array $iconProps = []) { | ||
parent::__construct($icon, $iconProps); | ||
$this->text($icon); | ||
} | ||
/** | ||
* Sets the icon that will be shown by the element. | ||
* | ||
* @param string $icon The name of a material design icon such as 'mdi-eye'. | ||
* The 'mdi' part can be omitted of the name as it is optional. | ||
*/ | ||
public function setIcon(string $icon) { | ||
$sub = substr($icon, 0, 3); | ||
|
||
if ($sub !== 'mdi') { | ||
$icon = 'mdi-'.$icon; | ||
} | ||
|
||
$this->getChild(0)->setText($icon); | ||
} | ||
} |