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

[FEATURE] Add categories DataProcessor #653

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

schloram
Copy link
Contributor

@schloram schloram commented Sep 15, 2023

With this DataProcessor we can get rid of the chunky categories TypoScript. Plus this one is easier to re-use.

Additionally to that I also re-formatted the output of the categories since we always thought that the comma-separated list is unnecessary if the data is already structured. The frontend always had to split the string into an array themselves (we never could use the string as is).
This is why I also changes the output from comma-separated list to an array of objects in the following format:

    "categories": [
      {
        "id": 3,
        "title": "Test Category 1"
      },
      {
        "id": 4,
        "title": "Test Category 2"
      },
      {
        "id": 7,
        "title": "Test Category 3"
      }
    ]

Example usage (get categories by relation record):

    categories = JSON
    categories {
        dataProcessing {
            10 = headless-categories
            10 {
                relation.fieldName = categories

                as = categories
            }
        }
    }

Example usage (get categories by comma-separated-list of category ids):

    categories = JSON
    categories {
        dataProcessing {
            10 = headless-categories
            10 {
                categoryIdList = 1,3,5

                as = categories
            }
        }
    }

@lukaszuznanski
Copy link
Collaborator

Hi, please fix codestyle and tests and we can merge it then :)

@coveralls
Copy link

coveralls commented Oct 2, 2023

Pull Request Test Coverage Report for Build 7250772858

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 64.231%

Totals Coverage Status
Change from base Build 7196892465: 0.0%
Covered Lines: 835
Relevant Lines: 1300

💛 - Coveralls

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 this pull request may close these issues.

None yet

3 participants