Does getBlockURL work as intended?

Permalink
I'm customizing the style of a block and trying to use $block->getBlockURL() to get a correct path for some images. I notice in the code however that the method checks for package path first, then tests if the file exists in the DIR_REL path. Shouldn't it be the other way around so it can be customized? getBlockPath() is doing just that.

Also (for both getBlockURL and getBlockPath), if you specify a filename as parameter to the method, shouldn't it be returned? It feels a bit strange doing:
echo $block->getBlockPath('/images/test.png') . '/images/test.png';

Thanks for any suggestions.

ConcreteConversion
 
ScottC replied on at Permalink Best Answer Reply
ScottC
Sure, I'll bite.

/**
* Gets a full URL to the directory containing all of a block's items, including JavaScript, tools, icons, etc...
* @param BlockType $bt
* @return string $url
*/
public function getBlockTypeAssetsURL($bt, $file = false) {

You should want to use Loader::helper('concrete/urls'); then $urls = new ConcreteUrlsHelper();
ConcreteConversion replied on at Permalink Reply
ConcreteConversion
Just what I needed, thank you! I was close to implementing that kind of method myself when I saw your answer. :) I solved it like this now:

In controller.php/view()
$this->set('urls', Loader::helper('concrete/urls'));

And in view.php:
<img src="<?php echo $urls->getBlockTypeAssetsURL($this->block, 'images/delete.png') ?>" />

Which is very nice since I can still use $this->block->getBlockPath() or getBlockURL() in the view if I need to use the original block path.