Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
Added the possibility to chain named routes using forward slashes (e.…
Browse files Browse the repository at this point in the history
…g: named1/named2).
  • Loading branch information
bkader committed May 27, 2018
1 parent f20fc6f commit f4c90d1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions skeleton/third_party/bkader/class-route.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,19 @@ public static function get_prefix()
*/
public static function named($name)
{
// In case of forward slashes.
if (false !== strpos($name, '/'))
{
// 1. Explode and clean elements.
$exp = array_clean(explode('/', $name));

// 2. Pass them to this method.
$exp = array_map(array('Route', 'named'), $exp);

// 3. Put back element together and return them.
return implode('/', $exp);
}

// Make the method remember cached routes.
static $cached = array();

Expand Down

0 comments on commit f4c90d1

Please sign in to comment.