PHP Class Contao\StyleSheets

Provide methods to handle style sheets.
Inheritance: extends Backend
Mostra file Open project: contao/core-bundle

Public Methods

Method Description
__construct ( ) Import the Files library
checkStyleSheetName ( string $strName ) : string Check the name of an imported file
compileDefinition ( array $row, boolean $blnWriteToFile = false, array $vars = [], array $parent = [], boolean $export = false ) : string Compile format definitions and return them as string
exportStyleSheet ( DataContainer $dc ) Export a style sheet
importStyleSheet ( ) : string Return a form to choose an existing style sheet and import it
updateStyleSheet ( integer $intId ) Update a particular style sheet
updateStyleSheets ( ) Update all style sheets in the scripts folder

Protected Methods

Method Description
compileColor ( mixed $color, boolean $blnWriteToFile = false, array $vars = [] ) : string Compile a color value and return a hex or rgba color
convertHexColor ( string $color, boolean $blnWriteToFile = false, array $vars = [] ) : array Convert hex colors to rgb
createDefinition ( array $arrDefinition ) Create a format definition and insert it into the database
generateBase64Image ( string $strImage, array $arrParent ) : string | boolean Return an image as data: string
shortenHexColor ( string $color ) : string Try to shorten a hex color
writeStyleSheet ( array $row ) Write a style sheet to a file

Method Details

__construct() public method

Import the Files library
public __construct ( )

checkStyleSheetName() public method

Check the name of an imported file
public checkStyleSheetName ( string $strName ) : string
$strName string
return string

compileColor() protected method

Compile a color value and return a hex or rgba color
protected compileColor ( mixed $color, boolean $blnWriteToFile = false, array $vars = [] ) : string
$color mixed
$blnWriteToFile boolean
$vars array
return string

compileDefinition() public method

Compile format definitions and return them as string
public compileDefinition ( array $row, boolean $blnWriteToFile = false, array $vars = [], array $parent = [], boolean $export = false ) : string
$row array
$blnWriteToFile boolean
$vars array
$parent array
$export boolean
return string

convertHexColor() protected method

Convert hex colors to rgb
See also: http://de3.php.net/manual/de/function.hexdec.php#99478
protected convertHexColor ( string $color, boolean $blnWriteToFile = false, array $vars = [] ) : array
$color string
$blnWriteToFile boolean
$vars array
return array

createDefinition() protected method

Create a format definition and insert it into the database
protected createDefinition ( array $arrDefinition )
$arrDefinition array

exportStyleSheet() public method

Export a style sheet
public exportStyleSheet ( DataContainer $dc )
$dc DataContainer

generateBase64Image() protected method

Return an image as data: string
protected generateBase64Image ( string $strImage, array $arrParent ) : string | boolean
$strImage string
$arrParent array
return string | boolean

importStyleSheet() public method

Return a form to choose an existing style sheet and import it
public importStyleSheet ( ) : string
return string

shortenHexColor() protected method

Try to shorten a hex color
protected shortenHexColor ( string $color ) : string
$color string
return string

updateStyleSheet() public method

Update a particular style sheet
public updateStyleSheet ( integer $intId )
$intId integer

updateStyleSheets() public method

Update all style sheets in the scripts folder
public updateStyleSheets ( )

writeStyleSheet() protected method

Write a style sheet to a file
protected writeStyleSheet ( array $row )
$row array