public setRelativeUrl ( string $url ) | ||
$url | string | The relative URL. e.g: /about/me/index.html |
public function setRelativeUrl($url)
{
$url = $this->prepareUrl($url);
$attributes = $this->getAttributes();
$attributes['url'] = $url;
$urlPath = $this->getPathFromUrl($url);
$this->item->setPath($urlPath, ItemInterface::SNAPSHOT_PATH_PERMALINK);
$this->setAttributes($attributes);
}
/** * @expectedException \RuntimeException */ public function testUrlWithoutStartWithSlash() { $item = new Item('Test of content', 'index.html', ['title' => 'My posts']); $event = new RenderEvent($item, Item::SNAPSHOT_RAW, Item::SNAPSHOT_PATH_RELATIVE); $event->setRelativeUrl('index.html'); }