ePages 6.15.1 - DE_EPAGES/Object/API/TLE/ObjectHandler.pm

Package DE_EPAGES::Object::API::TLE::ObjectHandler

Functions

CHILD
EXISTSCHILD
EXISTS_PATH
INSTANCEOF
ISELEMENTOFPATH
MULTISELECTEDVALUES
PARENTPATH
SORT

CHILD

Returns the child of an object by alias.

Syntax
#CHILD( #Parent, #Alias)
Example
#LOCAL("Child", #CHILD(#Shop.ProductFolder.Object, "08/15"))
  #Child.NameOrAlias
#ENDLOCAL
Input
#Parent (object)
parent object
#Alias (string)
child object alias

EXISTSCHILD

Returns true if the child of an object exists.

Syntax
#EXISTSCHILD( #Parent, #Alias)
Example
#IF( #EXISTSCHILD( #Object, "08/15" ) )
  #WITH( #CHILD(#Object, "08/15") )
    <b>#NameOrAlias</b>
  #ENDWITH
#ENDIF
Input
#Parent (object)
parent object
#Alias (string)
child object alias

EXISTS_PATH

Returns true if given path exists at object.

Syntax
#EXISTS_PATH(#Object, #Path)
Example
#EXISTS_PATH(#Shop.Object, "Categories/Imprint")
  (imprint exists)
#ENDIF
Input
#Object (object)
object, starting point
#Path (string)
path from object
Return
#Exists (boolean)
exists path in object

INSTANCEOF

Returns true if the object is an instance of class given by name.

Syntax
#INSTANCEOF( #Object, #ClassName )
Example
#IF( #INSTANCEOF( #Object, "Product" ) ) ... #ENDIF
Input
#Object (object)
object
#ClassName (string)
name of class

ISELEMENTOFPATH

Returns true if an object is a direct or indirect child of another object.

Syntax
#ISELEMENTOFPATH( #Object, #Parent)
Example
#IF( #ISELEMENTOFPATH( #Object, #Site) ) ... #ENDIF
#IF( #ISELEMENTOFPATH( #LeafCategory, #RootCategory) ... #ENDIF
Input
#Object (object)
leaf, object or ID of an object
#Parent (object)
parent, object or ID of an object

MULTISELECTEDVALUES

Returns a loop of all values of a multiple-selection attribute. For selected values the TLE #Selected is true.

Syntax
#MULTISELECTEDVALUES(#AllValues, #SelectedValues)
Example
#LOOP(#UserDefinedAttributeValues)
  #IF(#Attribute.Type EQ "PreDefMultiString" OR #Attribute.Type EQ "PreDefMultiLocalizedString" )
    #LOCAL("SelectedValues( #MULTISELECTEDVALUES( #Attribute.PreDefAttributes, #Value))
      #LOOP(#SelectedValues)
       <input type="checkbox" name="#Attribute.Alias" value="#ID" #IF(#Selected)checked="checked"#ENDIF />#ValueOrAlias<br />
      #ENDLOOP
    #ENDLOCAL
  #ENDIF
#ENDLOOP
Input
#AllValues (ref.array.object)
list of all attribute values of a selection attribute
#SelectedValues (ref.array.object)
list of selected attribute values of a selection attribute
Return
#Values (ref.array.hash)
list of all atttribute values of a selection attribute with keys
  • #ID - value id
  • #Value - value
  • #Alias - value alias
  • #ValueOrAlias - fallback to #Alias if value is undefined in the current language
  • #Selected - true if the value is selected

PARENTPATH

Returns an array containing the objectId path for an objectId. DE_EPAGES::Object::API::Object::Object::parentPath of Object is used to get all parent objects. If the objectId path would be (1, 2, 3, 4, 5) and RootObjectId is 3, the return value would be (3, 4, 5).

Syntax
#PARENTPATH( #ObjectID, #RootObjectID)
Example
JOIN("/", #PARENTPATH( #Object.ID, #Site.ID))
Input
#ObjectID (objectId)
objectId
#RootObjectID (objectId)
objectId of the root object

SORT

Sorts an array of objects by an attribute. The sort order is ascending by default. The sort criteria (numeric or alphabetically) depends on the type of the attribute. See also DE_EPAGES::Object::API::Factory::SortObjects.

Syntax
#SORT(#Elements, #AttributeName)
#SORT(#Elements, #AttributeName, #ReverseDirection)
Example
#LOOP(#SORT(#Products, "IsVisible")) #Alias - #IsVisible #ENDLOOP
#LOOP(#SORT(#Products, "IsVisible", 1) #Alias - #IsVisible #ENDLOOP
Input
#Elements (ref.array.object)
TLE loop
#AttributeName (string)
name of an object attribute
#ReverseDirection (boolean)
(optional, default=0) 1 = sort descending
Return
#SortedElements (ref.array.object)
sorted list of objects