We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Assets - Cannot skip filter

Cannot skip filter, _filter always stay true;

This only happens with

$this->assets->collection(self::$COLLECTIONS[$name][0])->addJs('/', false, false);

Like this works

$this->assets->addJs('/', true, false)

but i need skip some in a collection!

["admin-core-js"]=> object(Phalcon\Assets\Collection)#102 (12) { ["_prefix":protected]=> NULL ["_local":protected]=> bool(true) ["_resources":protected]=> array(30) { [0]=> object(Phalcon\Assets\Resource\Js)#104 (8) { ["_type":protected]=> string(2) "js" ["_path":protected]=> string(1) "/" ["_local":protected]=> bool(false) ["_filter":protected]=> bool(true) ["_attributes":protected]=> array(0) { } ["_sourcePath":protected]=> NULL ["_targetPath":protected]=> NULL ["_targetUri":protected]=> NULL }



9.7k
Accepted
answer

$js = new \Phalcon\Assets\Resource\Js($path, $local, $filter); $this->assets->collection(self::$COLLECTIONS[$name][0])->add($js);

works, maybe is here the problem https://github.com/phalcon/cphalcon/blob/master/phalcon/assets/collection.zep

Line 142||170 if !filter { let filter = true; }