mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 00:06:37 +02:00
added a relativePath() method
This commit is contained in:
@@ -146,6 +146,21 @@ class Medium extends Data implements RenderableInterface
|
||||
return $this->get('filepath');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the relative path to file
|
||||
*
|
||||
* @param bool $reset
|
||||
* @return mixed
|
||||
*/
|
||||
public function relativePath($reset = true)
|
||||
{
|
||||
if ($reset) {
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
return str_replace(GRAV_ROOT, '', $this->get('filepath'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return URL to file.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user