Skip to content

Instantly share code, notes, and snippets.

@nsams
Created November 10, 2014 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsams/ad21e2a4f43e01fa0d5c to your computer and use it in GitHub Desktop.
Save nsams/ad21e2a4f43e01fa0d5c to your computer and use it in GitHub Desktop.
$ret['assets']['files'][] = new Vkwc_Statistics_Opt_ConfigAsset();
<?php
class Vkwc_Statistics_Opt_ConfigAsset extends Kwf_Assets_Dependency_Abstract
{
public function getMimeType()
{
return 'text/javascript';
}
public function getContents($language)
{
$config = array();
foreach (Kwf_Component_Abstract::getComponentClasses() as $cls) {
if (is_instance_of($cls, 'Kwc_Statistics_Opt_Component')) {
$config['optChangedUrl'] = Kwc_Admin::getInstance($cls)->getControllerUrl('OptChanged').'/json-opt-changed';
break;
}
}
return 'Kwf.namespace(\'Kwc.Statistics.Opt\'); Kwc.Statistics.Opt.config = '.json_encode((object)$config).";\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment