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?
<code>
$bv = new BlockView();
$bv->setBlockObject($this->getBlockObject());
$blockURL = $bv->getBlockURL();
</code>
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 athttp://www.weblicating.com/cheat-sheet,... 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,
thanks
<code>
$bv = new BlockView();
$bv->setBlockObject($this->getBlockObject());
$blockURL = $bv->getBlockURL();
</code>
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 athttp://www.weblicating.com/cheat-sheet,... 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,
thanks
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.
Hi,
The "setBlockObject" method was removed from BlockView class, so you have to pass the block obj in constructor:
hope that helps,
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,
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?
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?
Yes indeed, and it would be better then.