eZ Publish - Adding Bootstrap Glyphicons

If you are using Bootstrap with eZ Publish, you can add a custom tag to include glyphicons which will allow editors to add the icons into their content.

This is a simple implementation, it allows the user to enter the name of the icon they would like to use.

content.ini.append.php

Code

<?php /* ini charset="utf-8"
 
[CustomTagSettings]
AvailableCustomTags[]=glyphicon
IsInline[glyphicon]=true
 
[glyphicon]
CustomAttributes[]
CustomAttributes[]=name
 
*/ ?>

The template HTML must match the Bootstrap version in use.

design/site/templates/content/datatype/view/ezxmltags/glyphicon.tpl

<!-- Choose the HTML for the tag based on the version of Bootstrap you are using -->
<span class="glyphicon glyphicon-{$name}"></span>

<!-- or -->

<i class="icon-{$name}"></i>