Element

From PunchCMS
Revision as of 14:51, 3 May 2009 by Admin (Talk | contribs)

Jump to: navigation, search

Element Methods

get ([elementApiName], [recursive])

Get the first element or folder with an optional specific api name from an element.

getElements ([elementApiName], [getFirst], [recursive])

Get a list of elements and folders with an optional specific api name from an element.

getFolders ([elementApiName], [recursive])

Get a list of folders with an optional specific api name from an element.

getElementByTemplate (templateApiName, [recursive], [random])

Get the first element with a specific template api name from an element.

getElementsByTemplate (templateApiName, [getFirst], [recursive], [random])

Get a list of elements with a specific template api name from an element.

getElementByTemplateId (templateId, [recursive], [$random])

Get the first element with a specific template id from an element.

getElementsByTemplateId (templateId, [getFirst], [recursive], [random])

Get a list of elements with a specific template id from an element.

getFields ()

Get the list of fields from an element.

getField (fieldName)

Get a field with a specific name from an element.

getPageId ()

Get the first element id that is a complete page from an element. This method walks through all the parent elements until it finds an element that is a complete page.

getParent ()

Get the parent element from an element.

findParentByName (elementApiName, [selfInclude])

Get the parent element or folder with a specific api name from an element.

findParentByTemplateName (templateApiName, [selfInclude])

Get the parent element with a specific template api name from an element.

hasParentId (parentId)

Check wether an element has a parent element or folder (recursive) with a specific id.

getTemplateName ()

Get the template api name from an element.

getId ()

Get the id from an element.

getName ()

Get the api name from an element.

getLink ([absolute], [addQuery])

Get the link URL from an element.

getPageByChild (child, pageItems, [childType])

Get the page index of a child element. Used for redirection to a specific item in a collection.

isPage ()

Check if the element is a complete page.

getElement ()

Get the real element object from the wrapper.

prepareNewElement ()

Get an with the parent set as the current element. Used to add user generated data to the CMS.