Current File : /home/aventura/www/site/wp-content/plugins/victheme_core/vtcore/bootstrap/form/bsglyphicon.php |
<?php
/**
* Helper Class for building the bootstrap glyphicon
* icon selector.
*
* This HTML output is compatible with the icon picker js.
*
* @author jason.xie@victheme.com
* @see VTCore_Form_Interface interface
*/
class VTCore_Bootstrap_Form_BsGlyphicon
extends VTCore_Bootstrap_Form_BsSelect
implements VTCore_Form_Interface {
/**
* Declaring icon type
* base on Bootstrap 3 Glyphicon
*/
protected $icons = array(
'asterisk', 'plus', 'euro', 'minus', 'cloud', 'envelope', 'pencil', 'glass', 'music', 'search', 'heart', 'star', 'star-empty',
'user', 'film', 'th-large', 'th', 'th-list', 'ok', 'remove', 'zoom-in', 'zoom-out', 'off', 'signal', 'cog', 'trash', 'home',
'file', 'time', 'road', 'download-alt', 'download', 'upload', 'inbox', 'play-circle', 'repeat', 'refresh', 'list-alt', 'lock',
'flag', 'headphones', 'volume-off', 'volume-down', 'volume-up', 'qrcode', 'barcode', 'tag', 'tags', 'book', 'bookmark', 'print',
'camera', 'font', 'bold', 'italic', 'text-height', 'text-width', 'align-left', 'align-center', 'align-right', 'align-justify',
'list', 'indent-left', 'indent-right', 'facetime-video', 'picture', 'map-marker', 'adjust', 'tint', 'edit', 'share', 'check',
'move', 'step-backward', 'fast-backward', 'backward', 'play', 'pause', 'stop', 'forward', 'fast-forward', 'eject', 'chevron-left',
'chevron-right', 'plus-sign', 'minus-sign', 'remove-sign', 'ok-sign', 'question-sign', 'info-sign', 'screenshot', 'remove-circle',
'ok-circle', 'ban-circle', 'arrow-left', 'arrow-right', 'arrow-up', 'arrow-down', 'share-alt', 'resize-full', 'resize-small', 'exclamation-sign',
'gift', 'leaf', 'fire', 'eye-open', 'eye-close', 'warning-sign', 'plane', 'calendar', 'random', 'comment', 'magnet', 'chevron-up', 'chevron-down',
'retweet', 'shopping-cart', 'folder-close', 'folder-open', 'resize-vertical', 'resize-horizontal', 'hdd', 'bullhorn', 'bell', 'certificate',
'thumbs-up', 'thumbs-down', 'hand-right', 'hand-left', 'hand-up', 'hand-down', 'circle-arrow-right', 'circle-arrow-left', 'circle-arrow-up',
'circle-arrow-down', 'globe', 'wrench', 'tasks', 'filter', 'briefcase', 'fullscreen', 'dashboard', 'paperclip', 'heart-empty', 'link', 'phone',
'pushpin', 'usd', 'gbp', 'sort', 'sort-by-alphabet', 'sort-by-alphabet-alt', 'sort-by-order', 'sort-by-order-alt', 'sort-by-attributes',
'sort-by-attributes-alt', 'unchecked', 'expand', 'collapse-down', 'collapse-up', 'log-in', 'flash', 'log-out', 'new-window', 'record',
'save', 'open', 'saved', 'import', 'export', 'send', 'floppy-disk', 'floppy-saved', 'floppy-remove', 'floppy-save', 'floppy-open',
'credit-card', 'transfer', 'cutlery', 'header', 'compressed', 'earphone', 'phone-alt', 'tower', 'stats', 'sd-video', 'hd-video', 'subtitles',
'sound-stereo', 'sound-dolby', 'sound-5-1', 'sound-6-1', 'sound-7-1', 'copyright-mark', 'registration-mark', 'cloud-download', 'cloud-upload',
'tree-conifer', 'tree-deciduous',
);
protected $context = array(
'text' => false,
'prefix' => false,
'suffix' => false,
'description' => false,
'required' => false,
'value' => false,
'id' => false,
'name' => false,
'class' => array('form-icon-picker'),
// BootStrap Rules
'label' => true,
// Wrapper element
'type' => 'div',
'attributes' => array(
'class' => array(
'form-group',
'form-icons-iconpicker',
),
'data-prefix' => 'glyphicon-',
'data-base' => 'glyphicon',
'data-element' => 'span',
),
// Internal use, Only override if needed
'input_elements' => array(),
'label_elements' => array(),
'description_elements' => array(),
'prefix_elements' => array(),
'suffix_elements' => array(),
'required_elements' => array(),
);
/**
* Build a options valid for select element
*/
protected function buildOptions() {
$this->options = array(
false => __('No Icon', 'victheme_core'),
);
sort(array_unique($this->icons));
foreach ($this->icons as $icon) {
$this->options[$icon] = ucfirst(str_replace('-', ' ', $icon));
}
return $this;
}
/**
* Overridding parent method
* @see VTCore_Bootstrap_Form_BsSelect::buildElement()
*/
public function buildElement() {
VTCore_Wordpress_Utility::loadAsset('jquery-iconpicker');
VTCore_Wordpress_Utility::loadAsset('bootstrap');
$this->buildOptions();
$this->setContext(array('options' => $this->options));
parent::buildElement();
}
}