Yosymfony\Spress\Core\Plugin\Event\RenderEvent::getRelativeUrl PHP Method

getRelativeUrl() public method

Gets the relative URL (only path component) of the item.
public getRelativeUrl ( ) : string
return string
    public function getRelativeUrl()
    {
        $attributes = $this->getAttributes();
        return array_key_exists('url', $attributes) ? $attributes['url'] : '';
    }

Usage Example

Exemplo n.º 1
0
 public function testRenderEvent()
 {
     $item = new Item('Test of content', 'index.html', ['title' => 'My posts']);
     $item->setPath('index.html', Item::SNAPSHOT_PATH_RELATIVE);
     $event = new RenderEvent($item, Item::SNAPSHOT_RAW, Item::SNAPSHOT_PATH_RELATIVE);
     $this->assertEquals('', $event->getRelativeUrl());
     $event->setRelativeUrl('/welcome/index.html');
     $this->assertEquals('/welcome/index.html', $event->getRelativeUrl());
 }