Get Relative Block URL From Block Controller?

Permalink
This might be so simple that I'm overlooking it, but I'm trying to get the relative URL to a block from its controller. A block view has a nice getBlockURL method that provides the string I need, but I need to get that string from the controller. I can load the url helper and use the getBlockTypeAssetsURL method, but that returns the full url. Sure, I can parse the string, but surely there's a more straightforward way to go about it. Anyone know?

Thanks,

-Steve

Shotster
View Replies:
jordanlev replied on at Permalink Reply
jordanlev
It's a bit verbose, but here you go:
$bv = new BlockView();
$bv->setBlockObject($this->getBlockObject());
$blockURL = $bv->getBlockURL();
Shotster replied on at Permalink Reply
Shotster
Thanks, Jordan. Yeah, that's a lot of overhead and seems to be a really inefficient method of getting a simple string - especially one that should be readily accessible to a block controller.

What I decided to to is tweak the getBlockTypeAssetsURL helper method in urls.php to return a relative url if passed a boolean as the last argument.

-Steve