$name = substr($name, 1, -1); //if the name doesn't have an extension if (strpos($name, '.') === false) { //make it html $name .= '.html'; } //if the name doesn't start with a / if (strpos($name, '/') !== 0) { //add / $name = '/' . $name; } //this is the final name //which is also the path to the template $name = $path . $name; //get the partial $partial = Eden\Handlebars\Runtime::getPartial($name); //if there is no partial and file exists if (is_null($partial) && file_exists($name)) { //this is the partial $partial = file_get_contents($name); //register the partial Eden\Handlebars\Runtime::registerPartial($name, $partial); } //prep to call tokenize $tokenize = Eden\Handlebars\Runtime::getHelper('tokenize->'); //bind the arguments back $options['args'] = str_replace('partial ', '> ', $options['args']); array_unshift($args, "'" . $name . "'"); array_push($args, $options); return call_user_func_array($tokenize, $args); }, 'strip' => function ($html, $options) {
public function testUnregisterPartial() { Eden\Handlebars\Runtime::registerPartial('foo', 'bar'); Eden\Handlebars\Runtime::unregisterPartial('foo'); $this->assertNull(Eden\Handlebars\Runtime::getPartial('foo')); }