.. include:: ../../Includes.txt
Icons API
^^^^^^^^^
New methods have been added for the purpose of icons generation. The
HTML should not be written manually but rather should be generated by
the means of the API. The official format for icons is PNG 24 bits.
There is a special fix for IE6 that solves the PNG transparency's
issue.
The tables bellow gives an overview of the most common classes that
are involved in the icons API.
.. ### BEGIN~OF~TABLE ###
.. container:: table-row
Classes
Classes
Description
Description
.. container:: table-row
Classes
**final t3lib\_iconWorks** t3lib/class.t3lib\_iconworks.php
Description
Icon generation, backend
This library has functions that returns - and if necessary creates -
the icon for an element in TYPO3
.. container:: table-row
Classes
**t3lib\_SpriteManager** t3lib/class.t3lib\_spritemanager.php
Description
TYPO3 sprite manager, used in BE and in FE if a BE user is logged in.
This class builds CSS definitions of registered icons, writes TCA
definitions and registers sprite icons in a cache file.
A configurable handler class does the business task.
.. container:: table-row
Classes
**interface t3lib\_spritemanager\_SpriteIconGenerator** t3lib/interfac
es/interface.t3lib\_spritemanager\_spriteicongenerator.php
Description
Interface all handlers for t3lib\_spritemanager have to implement.
.. container:: table-row
Classes
**t3lib\_spritemanager\_SimpleHandler**
t3lib/spritemanager/class.t3lib\_spritemanager\_simplehandler.php
Description
A class with an concrete implementation of
t3lib\_spritemanager\_SpriteIconGenerator.
It is the standard / fallback handler of the sprite manager. This
implementation won't generate sprites at all. It will just render css-
definitions for all registered icons so that they may be used through
t3lib\_iconWorks::getSpriteIcon. Without the css classes generated
here, icons of for example TCA records would be empty.
.. ###### END~OF~TABLE ######
The section below gives examples how to use method of t3lib\_iconWorks
.. ### BEGIN~OF~TABLE ###
.. container:: table-row
Method name
Method name
Description
Description
.. container:: table-row
Method name
t3lib\_iconWorks::getSpriteIconClasses($iconName)
Description
generic method to create the final CSS classes based on the sprite
icon name with the base class and splits the name into parts is
usually called by the methods that are responsible for fetching the
names out of the file name, or the record type
.. ###### END~OF~TABLE ######
((generated))
"""""""""""""
Example
~~~~~~~
::
####
t3lib_iconWorks::getSpriteIconClasses('actions-document-new')
Result:
t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new
.. ### BEGIN~OF~TABLE ###
.. container:: table-row
Method name
Method name
Description
Description
.. container:: table-row
Method name
t3lib\_iconWorks::getSpriteIcon($iconName, array $options = array(),
array $overlays = array())
Description
This generic method is used throughout the TYPO3 Backend to show icons
in any variation which are not bound to any file type (see
getSpriteIconForFile) or database record (see getSpriteIconForRecord)
.. ###### END~OF~TABLE ######
Examples
~~~~~~~~
::
####
t3lib_iconWorks::getSpriteIcon('actions-document-new')
Result:
####
t3lib_iconWorks::getSpriteIcon('actions-document-new', array('title' => 'foo'))
Result:
####
t3lib_iconWorks::getSpriteIcon('actions-document-new', array(), array('status-overlay-hidden' => array()))
Result: notice the additional "t3-icon-overlay" class
.. ### BEGIN~OF~TABLE ###
.. container:: table-row
Method name
Method name
Description
Description
.. container:: table-row
Method name
t3lib\_iconWorks::getSpriteIconForRecord($table, array $row, array
$options = array())
Description
This method is used throughout the TYPO3 Backend to show icons for a
DB record.
Generates a HTML tag with proper CSS classes. The TYPO3 skin has
defined these CSS classes already to have a pre-defined background
image, and the correct background-position to show the necessary icon.
.. ###### END~OF~TABLE ######
Examples
~~~~~~~~
::
####
t3lib_iconWorks::getSpriteIconForRecord('tt_content', array())
Result:
####
t3lib_iconWorks::getSpriteIconForRecord('tt_content', array('hidden' => 1))
Result:
####
t3lib_iconWorks::getSpriteIconForRecord('tt_content', array(), array('class' => 'foo', 'title' => 'bar'))
Result:
.. ### BEGIN~OF~TABLE ###
.. container:: table-row
Method name
Method name
Description
Description
.. container:: table-row
Method name
t3lib\_iconWorks::getSpriteIconForFile($file, array $options =
array())
Description
This method is used throughout the TYPO3 Backend to show icons for a
file type.
Generates a HTML tag with proper CSS classes. The TYPO3 skin has
defined these CSS classes already to have a pre-defined background
image, and the correct background-position to show the necessary icon.
.. ###### END~OF~TABLE ######
Examples
~~~~~~~~
::
####
t3lib_iconWorks::getSpriteIconForFile('pdf')
Result:
####
t3lib_iconWorks::getSpriteIconForFile('filename.pdf')
Result:
####
t3lib_iconWorks::getSpriteIconForFile('pdf', array('title' => 'bar'))
Result: