ElementHelper
- Type
- Class
- Namespace
- Craft
- Inherits
- Craft\ElementHelper
- Since
- 2.0
Class ElementHelper
See also http://craftcms.com
View source (opens new window)
# Public Methods
Method | Description |
---|---|
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 (opens new window)
Arguments
$str
(string (opens new window))
Returns
Signature
public static string createSlug ( $str )
# doesUrlFormatHaveSlugTag()
Returns whether a given URL format has a proper {slug} tag.
View source (opens new window)
Arguments
$urlFormat
(string (opens new window))
Returns
Signature
public static boolean doesUrlFormatHaveSlugTag ( $urlFormat )
# getEditableLocaleIdsForElement()
Returns the editable locale IDs for a given element, taking user locale permissions into account.
View source (opens new window)
Arguments
$element
(Craft\BaseElementModel)
Returns
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 (opens new window)
Arguments
$element
(Craft\BaseElementModel)
Returns
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 (opens new window)
Arguments
$elements
(Craft\BaseElementModel[]) – The array of elements.
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 (opens new window)
Arguments
$element
(Craft\BaseElementModel)
Throws
Signature
public static void setUniqueUri ( Craft\BaseElementModel $element )
# setValidSlug()
Sets a valid slug on a given element.
View source (opens new window)
Arguments
$element
(Craft\BaseElementModel)
Returns
Signature
public static null setValidSlug ( Craft\BaseElementModel $element )