[NFC] Remove some more of the old cvs blocks
[civicrm-core.git] / CRM / Core / Smarty / plugins / function.crmResURL.php
index 800c56997df0449cbcb231f1535179d940a0bf67..e73e67ac33ab4b975c4307b9672f3c8adc8c99cf 100644 (file)
  * Determine the URL of a resource file
  *
  * @param array $params
+ *   Identify the resource by either 'ext'+'file' or 'expr'.
+ *
  *   Array with keys:
  *   - ext: string, extension name. see CRM_Core_Resources::getUrl
  *   - file: string, relative file path. see CRM_Core_Resources::getUrl
+ *   - expr: string, a dynamic path expression. See: \Civi\Core\Paths::getUrl()
  * @param CRM_Core_Smarty $smarty
  *
  * @return string
  */
 function smarty_function_crmResURL($params, &$smarty) {
+  if (!empty($params['expr'])) {
+    return Civi::paths()->getUrl($params['expr'], 'absolute');
+  }
+
   $res = CRM_Core_Resources::singleton();
   if (!array_key_exists('file', $params)) {
     $params['file'] = NULL;