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

Using taxonomy="false" in a collection tag still tries to filter by taxonomy. #1388

Closed
mariovass opened this Issue Apr 13, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@mariovass

mariovass commented Apr 13, 2017

Our blog & Careers listings are all broken due to the update in 2.5.8. Now we get the famous "Whoops, looks like something went wrong."

statamic-2017-04-13.txt

Error Log.

@colinmeinke

This comment has been minimized.

colinmeinke commented Apr 13, 2017

Not sure if this helps with context - looking back it seems the upgrade to 2.5.3 on the 10th Feb removed all of the taxonomy files. And just left us with a root file for each type. Pretty sure that shouldn't have happened? Mario has added these tags back manually following the structure from another new site running 2.5.8, but we are still getting the error above.

Before 2.5.3 upgrade:

After 2.5.3 upgrade:

@colinmeinke

This comment has been minimized.

colinmeinke commented Apr 13, 2017

Okay I think I've found the issue. We have a partial, and that outputs a list of jobs.

{{ collection:jobs sort="date:asc" taxonomy="{ t }" scope="job" }}
  ...
{{ /collection:jobs }}

Where t is either true or false. 2.5.8 now throws when passed false. Seems to work okay if always set to true tbh - if there isn't a taxonomy term in the url it displays all by default.

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Apr 13, 2017

We made some changes to the collection tag in the last release. Didn't really think about people passing false into the taxonomy parameter.

The following fixes it. taxonomy="false" will act as though you don't have the parameter there at all. That's what you want, right?

statamic/bundles/Collection/CollectionTags.php

image

...and here's the raw text for copy/pasting:

        if ($this->get('taxonomy') === 'false') {
            return false;
        } elseif ($this->get('taxonomy') === 'true') {
            $taxonomyCollection = $this->getTaxonomyCollectionFromUri();
        } else {
            $taxonomyCollection = $this->getTaxonomyCollectionFromParams($collection);
        }

Regarding the taxonomy term files being removed... Did they have anything inside them?

@colinmeinke

This comment has been minimized.

colinmeinke commented Apr 13, 2017

Cool, thanks. Yes they all had a title and an id:

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Apr 13, 2017

Yep. The migrator handles those. They can be removed.

@colinmeinke

This comment has been minimized.

colinmeinke commented Apr 13, 2017

Okay great, where does that data live now, out of interest? On another new Statamic site it's still adding that tag data into directories within taxonomies.

@jasonvarga jasonvarga changed the title from Breaking change in v2.5.8 - ErrorException: Undefined offset: 1 Collection Tags to Using taxonomy="false" in a collection tag still tries to filter by taxonomy. Apr 13, 2017

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Apr 13, 2017

It lives in the content.

tags:
  - Enterprise Solutions
  - Another One

If you create the taxonomies manually through the CP, it'll create the files. Since 2.5 there's generally no reason to manually create them, though.

https://docs.statamic.com/taxonomies

@colinmeinke

This comment has been minimized.

colinmeinke commented Apr 13, 2017

Nice, thanks!

@jasonvarga jasonvarga closed this Apr 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment