Giter Site home page Giter Site logo

anselmdk / silverstripe-iconfont-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from peavers-archive/silverstripe-font-awesome

1.0 1.0 1.0 1.31 MB

Generic icon font picker based on peavers/silverstripe-font-awesome

PHP 57.50% CSS 5.77% JavaScript 32.62% Scheme 4.11%

silverstripe-iconfont-picker's Introduction

THIS IS A FORK OF peavers/silverstripe-font-awesome

...adjusted to work with any icon font.

Configuration example

$iconPickerField = IconFontPickerField::create('CustomIconClass', 'Icon');
$iconPickerField->setCustomFontURI('mysite/thirdparty/icofont-custom/css/icofont.css');
$iconPickerField->setCustomFontBaseClass('icofont');
$iconPickerField->setAvailableIcons($this->config()->available_icons);
$iconPickerField->setUseFontAwesome(false);

Initial Readme

Synopsis

Provides a field to easily pick font-awesome icons

Features

  • Easily pick icons to be used anywhere in the frontend
  • Can filter on icon name

Installation

Composer

Make sure you're not double loading the css/fonts with a theme.

Ideally composer will be used to install this module. composer require "moe/font-awesome:@stable"

Screen shots

Font awesome icon view

Font awesome icon

Filter view

Filter

Usage

A basic working example, and the following to any class you want the field on;

    private static $db = array(
        'Icon' => 'Varchar(255)',
    );

    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->addFieldsToTab('Root.Main', array(
           FontAwesomeField::create("Icon", "Font Awesome icon")
        ));

        return $fields;
    }

Then simple include in the template where you want the icon placed

    <i class="fa $Icon"></i>

The controller extension should make sure you've got access to the icons so you don't need to double up the CSS file.

Want colours instead of icons?

Got you covered, checkout color-swabs!

Libraries used/modified

  • Font Awesome Icon Picker 4.5

silverstripe-iconfont-picker's People

Contributors

anselmdk avatar peavers avatar

Stargazers

Jaydn de Graaf avatar

Watchers

James Cloos avatar

Forkers

plastyk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.