Skip to content

Commit

Permalink
Merge pull request #79 from gios-asu/develop
Browse files Browse the repository at this point in the history
prod: adding slugify handlebars helper
  • Loading branch information
rraub committed Nov 15, 2016
2 parents c6f3b96 + 909d0b6 commit e46ab02
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/view/extensions/handlebars-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private function add_engine_helpers() {
$this->add_conditional_operators();
$this->add_strip_tags();
$this->add_config();
$this->add_slugify_helper();
}

private function add_config() {
Expand All @@ -89,6 +90,19 @@ function ( $template, $context, $args ) {
);
}

/**
* Slugify Helper - lets you slugify any string
*/
private function add_slugify_helper() {
$this->engine->addHelper(
'slugify',
function ( $template, $context, $args ) {
$arg = $context->get( $args );
return slugify( $arg );
}
);
}

/**
* No Tags Formatter
*
Expand Down

0 comments on commit e46ab02

Please sign in to comment.