Skip to content

Commit

Permalink
Merge pull request #809 from tractorcow/feat/base-url
Browse files Browse the repository at this point in the history
feat: add absolute base url for locales
  • Loading branch information
tractorcow authored Sep 1, 2023
2 parents 6313e6d + 904e3f4 commit ba53c83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Extension/FluentVersionedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,8 @@ protected function setVersionCacheItem(string $class, string $stage, string $loc
// Internally store nulls as 0
$this->versionsCache[$class][$stage][$locale][$key] = $value ?: 0;
}
/**

/**
* If an object is duplicated also duplicate existing localised values from original to new object.
*/
public function onAfterDuplicate($original, $doWrite, $relations): void
Expand Down Expand Up @@ -1055,8 +1055,6 @@ public function onAfterDuplicate($original, $doWrite, $relations): void
SELECT ? AS \"RecordID\", $fields_str
FROM \"$versionsTableName\"
WHERE \"RecordID\" = ?", [$toID, $fromID]);

}
}

}
10 changes: 10 additions & 0 deletions src/Model/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,16 @@ public function getBaseURL()
return $base;
}

/**
* Absolute base url
*
* @return false|string
*/
public function getAbsoluteBaseURL()
{
return Director::absoluteURL($this->getBaseURL());
}

/**
* Get other locales that appear alongside this (including self)
*
Expand Down

0 comments on commit ba53c83

Please sign in to comment.