CSSmartMacro
in package
Represents a Smart Macro which itself can be controlled by a CSSmartMacroPlugin
Tags
Table of Contents
- DATA_ATTRIBUTE_PREFIX = 'data-macro-'
- __construct() : mixed
- The constructor, normally called only by the static CSSmartMacros::createMacro method
- createFromTag() : CSSmartMacro
- Reads out the type of a macro html presentation and instantiates the corresponding macro object
- createMacro() : CSSmartMacro
- Loads a new Macro object for a given type, which is the plugin prefix
- getAttribute() : string
- Get's the actual value for an attribute from the Macro
- getAttributeDefinitions() : array<string|int, mixed>
- Reads via the plugin the attribute definitions of the macro
- getAttributes() : array<string|int, mixed>
- Retrieves the attributes of the macro
- getCategory() : string
- Each macro can belong to a category of macros, e.g. like the module name, etc.
- getCSSLink() : void
- Gets the CSSLink for a Macro normally the css file with the same file name next to it
- getDescription() : string
- The Description of the Macro which can be delivered by the Macro Plugin
- getPreviewUrl() : string
- Each macro can have a preview thumb that is shown in the macro chooser dialog The category is directly queried from the internal macro plugin
- getTitle() : string
- The Title of the Macro, normally the getPluginName() of the plugin
- getType() : string
- The Type of the macro, normally the type of the plugin
- isEditable() : bool
- Let a Macro Developer define if his macro should be editable in the document
- makeHtml() : string
- This method creates the html output for the macro
- makeHtmlForEditor() : string
- This method creates the html output for the macro in the edit mode
- makeHtmlForReader() : string
- This method creates the html output for the macro in the read only mode
- setAttribute() : mixed
- Sets an attribute to a given value within the internal plugin
Constants
DATA_ATTRIBUTE_PREFIX
public
mixed
DATA_ATTRIBUTE_PREFIX
= 'data-macro-'
Tags
Methods
__construct()
The constructor, normally called only by the static CSSmartMacros::createMacro method
public
__construct(mixed $sType[, string $sContent = '' ][, array<string|int, mixed> $aParams = array() ]) : mixed
Parameters
- $sType : mixed
- $sContent : string = ''
- $aParams : array<string|int, mixed> = array()
Tags
Return values
mixed —createFromTag()
Reads out the type of a macro html presentation and instantiates the corresponding macro object
public
static createFromTag(simple_html_dom_node $oTag) : CSSmartMacro
Parameters
- $oTag : simple_html_dom_node
-
the html element
Tags
Return values
CSSmartMacro —the macro
createMacro()
Loads a new Macro object for a given type, which is the plugin prefix
public
static createMacro(string $sType) : CSSmartMacro
Parameters
- $sType : string
-
the plugin prefix that controls this macro
Tags
Return values
CSSmartMacro —the macro object
getAttribute()
Get's the actual value for an attribute from the Macro
public
getAttribute(string $sName) : string
Parameters
- $sName : string
-
the name of the attribute
Tags
Return values
string —the value of the attribute
getAttributeDefinitions()
Reads via the plugin the attribute definitions of the macro
public
getAttributeDefinitions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —with the attribute name as key and the attribute name, type, etc. as value array
getAttributes()
Retrieves the attributes of the macro
public
getAttributes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —attribute names and values of the macro
getCategory()
Each macro can belong to a category of macros, e.g. like the module name, etc.
public
getCategory() : string
The category is directly queried from the internal macro plugin. The category is used in the macro chooser as group separator to organise the macros a little bit
Tags
Return values
string —the category
getCSSLink()
Gets the CSSLink for a Macro normally the css file with the same file name next to it
public
getCSSLink() : void
Tags
Return values
void —getDescription()
The Description of the Macro which can be delivered by the Macro Plugin
public
getDescription() : string
Tags
Return values
string —the description
getPreviewUrl()
Each macro can have a preview thumb that is shown in the macro chooser dialog The category is directly queried from the internal macro plugin
public
getPreviewUrl([int $width = 120 ][, null $height = NULL ]) : string
Parameters
- $width : int = 120
-
the width in pixel that is needed by the user interface
- $height : null = NULL
-
the height in pixel that is needed by the user interface - if left empty the height should be scaled proportionally to the width requested
Tags
Return values
string —the url to the thumb
getTitle()
The Title of the Macro, normally the getPluginName() of the plugin
public
getTitle() : string
Tags
Return values
string —the title
getType()
The Type of the macro, normally the type of the plugin
public
getType() : string
Tags
Return values
string —the type
isEditable()
Let a Macro Developer define if his macro should be editable in the document
public
isEditable() : bool
Tags
Return values
bool —TRUE if the Macro should be editable in the document
makeHtml()
This method creates the html output for the macro
public
makeHtml() : string
Tags
Return values
string —html output
makeHtmlForEditor()
This method creates the html output for the macro in the edit mode
public
makeHtmlForEditor() : string
Tags
Return values
string —the html code for the macro used in the editor view
makeHtmlForReader()
This method creates the html output for the macro in the read only mode
public
makeHtmlForReader([string $format = NULL ]) : string
Parameters
- $format : string = NULL
-
the format for which the macro should be rendered
Tags
Return values
string —the html code for the macro used in the read only view
setAttribute()
Sets an attribute to a given value within the internal plugin
public
setAttribute(string $sName, string $sValue) : mixed
Parameters
- $sName : string
-
the name of the attribute
- $sValue : string
-
the value of the attribute
