Skip to content

Commit

Permalink
Adding autorender() in abstract.php, with a small doc block
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrice Luraine committed Mar 11, 2010
1 parent 0303e16 commit eb4ce64
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion TODO
@@ -1,7 +1,7 @@
# TODO #

- explain before_render() in README
- adding autorender() in abstract.php
- explain autorender() in README
- testing and documenting autorendering features
- adding an option('display_errors'); by default ini_set('display_errors', 0) in production env, but enabled if env is dev (unless matching option is enabled)
- explain autoload_controller() in README
Expand Down
16 changes: 16 additions & 0 deletions lib/limonade/abstract.php
Expand Up @@ -146,3 +146,19 @@ function before_render($content_or_func, $layout, $locals, $view_path)
# transform $content_or_func, $layout, $locals or $view_path…
return array($content_or_func, $layout, $locals, $view_path);
}


/**
* Called only if option('autorender') is enabled and rendering $output is_null,
* like in a controller with no return statement.
*
* @abstract this function might be defined by user
* @param array() $route array (like returned by {@link route_build()},
* with keys "method", "pattern", "names", "function", "options")
* @return string
*/
function autorender($route)
{
# process output depending on $route
return $output;
}

0 comments on commit eb4ce64

Please sign in to comment.