本文整理匯總了PHP中ElementHelper::setUniqueUri方法的典型用法代碼示例。如果您正苦於以下問題:PHP ElementHelper::setUniqueUri方法的具體用法?PHP ElementHelper::setUniqueUri怎麽用?PHP ElementHelper::setUniqueUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ElementHelper
的用法示例。
在下文中一共展示了ElementHelper::setUniqueUri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getUrl
/**
* Returns the element's full URL.
*
* @return string
*/
public function getUrl()
{
if ($this->uri === null) {
ElementHelper::setUniqueUri($this);
}
return parent::getUrl();
}
示例2: updateElementSlugAndUri
/**
* Updates an element’s slug and URI, along with any descendants.
*
* @param BaseElementModel $element The element to update.
* @param bool $updateOtherLocales Whether the element’s other locales should also be updated.
* @param bool $updateDescendants Whether the element’s descendants should also be updated.
* @param bool $asTask Whether the element’s slug and URI should be updated via a background task.
*
* @return null
*/
public function updateElementSlugAndUri(BaseElementModel $element, $updateOtherLocales = true, $updateDescendants = true, $asTask = false)
{
if ($asTask) {
craft()->tasks->createTask('UpdateElementSlugsAndUris', null, array('elementId' => $element->id, 'elementType' => $element->getElementType(), 'locale' => $element->locale, 'updateOtherLocales' => $updateOtherLocales, 'updateDescendants' => $updateDescendants));
return;
}
ElementHelper::setUniqueUri($element);
craft()->db->createCommand()->update('elements_i18n', array('slug' => $element->slug, 'uri' => $element->uri), array('elementId' => $element->id, 'locale' => $element->locale));
// Delete any caches involving this element
craft()->templateCache->deleteCachesByElement($element);
if ($updateOtherLocales) {
$this->updateElementSlugAndUriInOtherLocales($element);
}
if ($updateDescendants) {
$this->updateDescendantSlugsAndUris($element, $updateOtherLocales);
}
}
示例3: updateElementSlugAndUri
/**
* Updates an element’s slug and URI, along with any descendants.
*
* @param BaseElementModel $element The element to update.
* @param bool $updateOtherLocales Whether the element’s other locales should also be updated.
* @param bool $updateDescendants Whether the element’s descendants should also be updated.
*
* @return null
*/
public function updateElementSlugAndUri(BaseElementModel $element, $updateOtherLocales = true, $updateDescendants = true)
{
ElementHelper::setUniqueUri($element);
craft()->db->createCommand()->update('elements_i18n', array('slug' => $element->slug, 'uri' => $element->uri), array('elementId' => $element->id, 'locale' => $element->locale));
// Delete any caches involving this element
craft()->templateCache->deleteCachesByElement($element);
if ($updateOtherLocales) {
$this->updateElementSlugAndUriInOtherLocales($element);
}
if ($updateDescendants) {
$this->updateDescendantSlugsAndUris($element);
}
}