Skip to content

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

@lukaszuznanski lukaszuznanski force-pushed the add-categories-dataprocessor branch from b496331 to 282c84b Compare May 9, 2024 14:37
@lukaszuznanski lukaszuznanski self-requested a review May 9, 2024 14:37
@lukaszuznanski
Copy link
Collaborator

@schloram we need to fix code quality checks and resolve conflicts, then we may think about merging it. Are you willing to continue?

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.

3 participants