本文整理汇总了PHP中Twig_Environment::get_src_config方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Environment::get_src_config方法的具体用法?PHP Twig_Environment::get_src_config怎么用?PHP Twig_Environment::get_src_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Environment
的用法示例。
在下文中一共展示了Twig_Environment::get_src_config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* Compiles the node to PHP.
*
* @param \Twig_Compiler A Twig_Compiler instance
*/
public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
$config = $this->environment->get_src_config();
$compiler->write("\$asset_file = ")->subcompile($this->getNode('expr'))->raw(";\n")->write("\$asset = new \\src\\template\\asset(\$asset_file, \$this->getEnvironment()->get_path_helper());\n")->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n")->indent()->write("\$asset_path = \$asset->get_path();")->write("\$local_file = \$this->getEnvironment()->get_src_root_path() . \$asset_path;\n")->write("if (!file_exists(\$local_file)) {\n")->indent()->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n")->write("\$asset->set_path(\$local_file, true);\n")->outdent()->write("\$asset->add_assets_version('{$config['assets_version']}');\n")->write("\$asset_file = \$asset->get_url();\n")->write("}\n")->outdent()->write("}\n")->write("\$context['definition']->append('{$this->get_definition_name()}', '");
$this->append_asset($compiler);
$compiler->raw("\n');\n");
}