Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permalink while editing title is different than the permalink shown in the admin #2516

Open
Tofandel opened this issue Mar 4, 2024 · 0 comments

Comments

@Tofandel
Copy link
Contributor

Tofandel commented Mar 4, 2024

Description

I want to hide the language in the permalink of the admin interface only for the default language (which I think is a common use case)

So I provide something like this according to https://twillcms.com/docs/modules/controllers.html

protected function formData($request): array
    {
        return parent::formData($request) + [
            'localizedCustomPermalink' => [
                config('app.locale') => route('partners.details', Partner::find($request->route('partner')))
            ]
        ];
    }

Which shows correctly here
image
image

But shows wrong information while editing
image

And prevents the configured custom permalink from updating on the page once it's been saved

It seems a different approach is needed for this to work, I'm thinking something like:

protected function formData($request): array
    {
        return parent::formData($request) + [
            'localizedCustomPermalink' => [
                config('app.locale') => route('partners.details', '{slug}')
            ]
        ];
    }

Maybe provided outside of formData as well that we could correctly use and replace in both places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant