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

Error when trying to Link Existing Item for Multi Taxonomy Term field. #4317

Closed
michaelr0 opened this issue Sep 27, 2021 · 0 comments · Fixed by #5915
Closed

Error when trying to Link Existing Item for Multi Taxonomy Term field. #4317

michaelr0 opened this issue Sep 27, 2021 · 0 comments · Fixed by #5915

Comments

@michaelr0
Copy link
Contributor

michaelr0 commented Sep 27, 2021

Bug Description

Error when trying to Link Existing Item for Multi Taxonomy Term field.

Call to a member function visible() on null
image

This looks like it is related to the Taxonomy column, which can be confirmed by trying to access the link used during the XHR request.
http://localhost:8000/cp/fieldtypes/relationship?...&columns=title,taxonomy&search=

Which then also errors.
image
image

The error goes away, when accessing the api and removing taxonomy from the columns.
What is odd is that we have only just started seeing this error pop up now, it wasn't an issue previously.

The taxonomy column appears to be getting added to the api url from the below code.
Statamic\Fieldtypes\Terms

    protected function getColumns()
    {
        $columns = [Column::make('title')];

        if (! $this->usingSingleTaxonomy()) {
            $columns[] = Column::make('taxonomy');
        }

        return $columns;
    }

How to Reproduce

Extra Detail

taxonomies/test.yml

title: Test

taxonomies/test2.yml

title: Test2

taxonomies/test/test.yml

title: test
content: test
updated_by: 90ad7de2-8e7e-4dae-81a0-7b1a91d10091
updated_at: 1632723240
blueprint: test

taxonomies/test2/test2.yml

title: test2
content: test2
updated_by: 90ad7de2-8e7e-4dae-81a0-7b1a91d10091
updated_at: 1632723253
blueprint: test2

resources/blueprints/collections/pages/pages.yml

title: Pages
sections:
  main:
    display: Main
    fields:
      -
        handle: title
        field:
          type: text
          required: true
          validate:
            - required
      -
        handle: content
        field:
          type: markdown
          display: Content
          localizable: true
          listable: hidden
          restrict: false
          automatic_line_breaks: true
          automatic_links: false
          escape_markup: false
          smartypants: false
          antlers: true
      -
        handle: taxonomy_terms
        field:
          mode: default
          create: false
          taxonomies:
            - test
            - test2
          display: 'Taxonomy Terms'
          type: terms
          icon: taxonomy
          listable: hidden
          instructions_position: above
  sidebar:
    display: Sidebar
    fields:
      -
        handle: slug
        field:
          type: slug
          required: true
          localizable: true
          validate:
            - required

Then go into a page and try to link a taxonomy term.

Environment

Statamic 3.2.8 Pro
Laravel 8.61.0
PHP 8.0.10

Install method:
Fresh install from statamic cli

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

Successfully merging a pull request may close this issue.

1 participant