Created
April 6, 2018 21:07
-
-
Save matdave/345c12204bf96b146fff0aeef76d739c to your computer and use it in GitHub Desktop.
MODX Font Awesome Selector TV
This file contains hidden or 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
[[+icon_class:replace=`fa-==`]] <i class="[[+icon_class:replace=`fa-==icon-`]] icon icon-large"></i> |
This file contains hidden or 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
<?php | |
$site_url=$modx->config['site_url']; | |
$subject = file_get_contents($site_url .'path/to/font-awesome.css'); | |
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s/'; | |
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER); | |
foreach($matches as $match){ | |
$iconclass = $match[1]; | |
$iconselect = $modx->getChunk('FontAwesomeIcon',array('icon_class' => $iconclass)) .'==' . $iconclass; | |
$icons= $icons . $iconselect .'||'; | |
} | |
//$icons= '--FontAwesome Icons--||' . $icons; | |
return ($icons); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment