Arturas Lapinskas
Arturas Lapinskas

Reputation: 336

SilverStripe 3.1 routing and Link function

I'm updating a SilverStripe website from 2.4 to 3.1.

I have many Links functions used in controllers and views.

The problem is that when I set routes.yml like this

Director:
  rules:
    'gottesdienste//$Action/$ID/$OtherID' : LiturgiesPage_Controller
    'veranstaltungen//$Action/$ID/$OtherID' : ArrangementsPage_Controller

Links in my site change from

gottesdienste/archive/2012

to

LiturgiesPage_Controller/archive/2012

How do I fix this?

Upvotes: 1

Views: 353

Answers (1)

user3477804
user3477804

Reputation:

You need to implement a custom Link() method that uses the base string you want.

public function Link($action = null) {
    return self::join_links('gottesdienste', $action);
}

Upvotes: 3

Related Questions