ePages 6.10 - 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
#FUNCTION("CHILD", #Parent, #Alias)
Example
#LOCAL("Child", #FUNCTION("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
#FUNCTION("EXISTSCHILD", #Parent, #Alias)
Example
#IF(#FUNCTION("EXISTSCHILD", #Object, "08/15"))
#WITH(#FUNCTION("CHILD", #Object, "08/15"))
  <b>#NameOrAlias</b>
#ENDWITH
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, "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 object is instance of class given by name.

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

ISELEMENTOFPATH

Returns true if object part of the object PathObject. DE_EPAGES::Object::API::Object::Object::parentPath of Object is used to get all parent objects.

Syntax
#FUNCTION("ISELEMENTOFPATH", #Object, #PathObject)
Example
#FUNCTION("ISELEMENTOFPATH", #Object, #Site)
#FUNCTION("ISELEMENTOFPATH", #LeafCategory, #RootCategory)
Input
#Object (object)
leaf, object or ID of an object
#PathObject (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
#FUNCTION("MULTISELECTEDVALUES", #AllValues, #SelectedValues)
Example
#LOOP(#UserDefinedAttributeValues)
  #IF(#Attribute.Type EQ "PreDefMultiString" OR #Attribute.Type EQ "PreDefMultiLocalizedString" )
    #LOCAL("SelectedValues", #FUNCTION("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
#FUNCTION("PARENTPATH", #ObjectID, #RootObjectID)
Example
#FUNCTION("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