Block URL

Permalink 1 user found helpful
I've been struggling with this one, we could get a blocks URL in a controller with 5.6 with the code below. I can't get anything to work in 5.7. Anyone have some thoughts on it?
$bv = new BlockView();
$blockURL = $bv->getBlockURL();

Also, working with Attributes, getting select attribute values and options seems tricky, if anyone has that stuff figured out if you could post, it would be appreciated!

I've updated a lot of the Cheat Sheet at,... things that do not have entries for 5.7 are things I haven't got worked out yet. If you have a few minutes take a look and send along some snippets,


View Replies:
Chrouglas replied on at Permalink Reply
Bump. I'd love to see a solution to this. I've gotten around this in a different custom block by just using getBlockURL() in the view.php file. But now I find I need it in the controller.php file.
Darragi replied on at Permalink Reply

The "setBlockObject" method was removed from BlockView class, so you have to pass the block obj in constructor:

$bv = new \Concrete\Core\Block\View\BlockView($this->getBlockObject());
        $blockURL = $bv->getBlockURL();

hope that helps,
Chrouglas replied on at Permalink Reply
Awesome thank you!!
I actually tried to do the use thing...
use /blah/blah/blah/BlockView (with real namespace in there)
Shouldn't that do the same thing?
Darragi replied on at Permalink Reply
Yes indeed, and it would be better then.