Skip to content

Instantly share code, notes, and snippets.

@Semdevmaster
Created September 16, 2022 07:09
Show Gist options
  • Save Semdevmaster/511f0705ebaaa2690e0746b04c48c4ed to your computer and use it in GitHub Desktop.
Save Semdevmaster/511f0705ebaaa2690e0746b04c48c4ed to your computer and use it in GitHub Desktop.
ZoomX smarty modifier for get asset from assets manifest
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Файл: modifier.asset.php
* Тип: modifier
* Имя: asset
* Назначение: Get asset from path.
* -------------------------------------------------------------
*/
function smarty_modifier_asset($path)
{
global $modx;
if ($modx->getOption('development', null, false, true)) {
return $modx->getPlaceholder('development_path') . $path;
}
return "assets/"
. $modx->getOption('assets_version', null, 'v1', true)
. "/"
. $modx->getPlaceholder('manifest')[$path]['file'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment