Concrete looking inside concrete folder for registered block assets
Permalink
Hi all,
After registering my assets in my custom block controller for a block which uses a plugin, I am getting an error saying that it can't find the file because it's looking in:
concrete/filepath/filename.min.js
instead of:
filepath/filename.min.js
It should be looking in application/filepath/filename.min.js seeing as that's where my block is, and I have tried adding 'application' to the filepath but it still just adds 'concrete/application/filepath/filename.min.js'
Any ideas why this might be happening?
Thank you!
After registering my assets in my custom block controller for a block which uses a plugin, I am getting an error saying that it can't find the file because it's looking in:
concrete/filepath/filename.min.js
instead of:
filepath/filename.min.js
It should be looking in application/filepath/filename.min.js seeing as that's where my block is, and I have tried adding 'application' to the filepath but it still just adds 'concrete/application/filepath/filename.min.js'
Any ideas why this might be happening?
Thank you!
Can you please provide some code? Often times this happens because of an incorrect path or namespace in the controller.
Sure:
The lines that I added were the 'use ...Asset' & 'Use ...AssetList' at the top, and the on_start and registerViewAssets functions at the bottom
Thank you!
<?php namespace Application\Block\blockname; defined("C5_EXECUTE") or die("Access Denied."); use Concrete\Core\Block\BlockController; use Concrete\Core\Asset\AssetList; use Concrete\Core\Asset\Asset; use Core; use Loader; class Controller extends BlockController { public $helpers = array ( 0 => 'form', ); public $btFieldsRequired = array ( 0 => 'name',
Viewing 15 lines of 136 lines. View entire code block.
The lines that I added were the 'use ...Asset' & 'Use ...AssetList' at the top, and the on_start and registerViewAssets functions at the bottom
Thank you!
On my local environment I set this up with the same stuff and created those directories and it worked perfectly for me. The only time it didn't work is if the path to the asset didn't exactly match the actual path inside the application folder.
That's really weird then... I have to write ../application to get it to start from the application folder. So yours does that by default anyway?
I was having the same problem. Looking in concrete/src/Asset/JavascriptAsset.php on line 33, you'll see that the path is set with the following code:
So, I cleared the cache and made sure all caching was turned off... it fixed the problem.
public static function getRelativeOutputDirectory() { return REL_DIR_FILES_CACHE.'/'.DIRNAME_JAVASCRIPT; }
So, I cleared the cache and made sure all caching was turned off... it fixed the problem.