ElementHelper

Type
Class
Namespace
Craft
Inherits
Craft\ElementHelper
Since
2.0

Class ElementHelper

See also http://craftcms.com

View source

Public Methods

MethodDescription
createSlug()Creates a slug based on a given string.
doesUrlFormatHaveSlugTag()Returns whether a given URL format has a proper {slug} tag.
getEditableLocaleIdsForElement()Returns the editable locale IDs for a given element, taking user locale permissions into account.
isElementEditable()Returns whether the given element is editable by the current user, taking user locale permissions into account.
setNextPrevOnElements()Given an array of elements, will go through and set the appropriate "next" and "prev" elements on them.
setUniqueUri()Sets the URI on an element using a given URL format, tweaking its slug if necessary to ensure it's unique.
setValidSlug()Sets a valid slug on a given element.

createSlug()

Creates a slug based on a given string.

View source

Arguments

Returns

string

Signature

public static string createSlug ( $str )

doesUrlFormatHaveSlugTag()

Returns whether a given URL format has a proper {slug} tag.

View source

Arguments

Returns

boolean

Signature

public static boolean doesUrlFormatHaveSlugTag ( $urlFormat )

getEditableLocaleIdsForElement()

Returns the editable locale IDs for a given element, taking user locale permissions into account.

View source

Arguments

Returns

array

Signature

public static array getEditableLocaleIdsForElement ( Craft\BaseElementModel $element )

isElementEditable()

Returns whether the given element is editable by the current user, taking user locale permissions into account.

View source

Arguments

Returns

boolean

Signature

public static boolean isElementEditable ( Craft\BaseElementModel $element )

setNextPrevOnElements()

Given an array of elements, will go through and set the appropriate "next" and "prev" elements on them.

View source

Arguments

Signature

public static void setNextPrevOnElements ( $elements )

setUniqueUri()

Sets the URI on an element using a given URL format, tweaking its slug if necessary to ensure it's unique.

View source

Arguments

Throws

Signature

public static void setUniqueUri ( Craft\BaseElementModel $element )

setValidSlug()

Sets a valid slug on a given element.

View source

Arguments

Returns

null

Signature

public static null setValidSlug ( Craft\BaseElementModel $element )