statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Localized taxonomies routes in routes.yaml cause php error in taxonomies/edit.blade.php #2518

Open piotrbochniak opened 4 years ago

piotrbochniak commented 4 years ago

Describe the bug Localized taxonomies routes in routes.yaml cause php error in taxonomies/edit.blade.php

To Reproduce Steps to reproduce the behavior:

  1. Create a Taxonomy with any name/slug let's say "foobar" / "foobar"
  2. In routes.yaml add custom localized route for the "foobar" taxonomy
    taxonomies:
    foobar:
    de: '/foobar-de/{slug}'
    fr: '/foobar-fr/{slug}'
    it: '/foobar-it/{slug}'
  3. Go to CP -> Taxonomies -> Manage Taxonomies -> foobar
  4. You will see a PHP error

Screenshots PHP error screenshot 1 PHP error screenshot 2

Expected behavior It should be allowed in the CP to edit Taxonomy with custom localized routes set.

Cause of the problem In the statamic\resources\views\taxonomies\edit.blade.php it is assumed that a custom route should be a string <input type="text" name="route" class="form-control" value="{{ $group->route() }}" />

It should be changed to work in a similar way to collection edit form statamic\resources\views\collections\edit.blade.php where there is a custom Vue Component used which allows to edit localized custom routes <routes-fieldtype :data="{{ json_encode($routes) }}" name="routes"></routes-fieldtype>

Same applies to Taxonomy create form.

Environment details (please complete the following information):