Skip to content

Commit

Permalink
Fixed #1728 very lamely
Browse files Browse the repository at this point in the history
Lame because it's Entry-specific code in the "generic" Resave Elements task. Already works as expected in Craft 3 though.
  • Loading branch information
brandonkelly committed May 23, 2017
1 parent 5965808 commit 5d52e55
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/tasks/ResaveElementsTask.php
Expand Up @@ -86,7 +86,23 @@ public function runStep($step)
{
$element = craft()->elements->getElementById($this->_elementIds[$step], $this->_elementType, $this->_localeId);

if (!$element || craft()->elements->saveElement($element, false))
if (!$element)
{
return true;
}

// (╯°□°)╯︵ ┻━┻
if ($element instanceof EntryModel)
{
$entryType = $element->getType();

if (!$entryType->hasTitleField)
{
$element->getContent()->title = craft()->templates->renderObjectTemplate($entryType->titleFormat, $element);
}
}

if (craft()->elements->saveElement($element, false))
{
return true;
}
Expand Down

0 comments on commit 5d52e55

Please sign in to comment.