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

Add overrideFields to FlexFormProcessor #551

Merged

Conversation

ducrot
Copy link
Contributor

@ducrot ducrot commented Feb 15, 2023

Configure individual fields of the FlexFormProcessor result. Same as overrideFields in DatabaseQueryProcessor, but for FlexFormProcessor (see also: bf8da47). Allows to convert typolinks, images, ...

Example

10 = FriendsOfTYPO3\Headless\DataProcessing\FlexFormProcessor
10 {
    fieldName = pi_flexform
    as = flexform
    overrideFields {
        image = TEXT
        image {
            dataProcessing {
                10 = FriendsOfTYPO3\Headless\DataProcessing\FilesProcessor
                10 {
                    references {
                        table = tt_content
                        fieldName = image
                    }
                    as = image
                }
            }
        }
        link = TEXT
        link {
            field = link
            htmlSpecialChars = 1
            typolink {
                parameter {
                    field = link
                }
                returnLast = result
            }
        }
    }
}

Result without overrideFields

{
  "flexform": {
	"image": "1",
	"link": "t3:\/\/page?uid=13"
  }
}

Result with overrideFields

{
  "flexform": {
	"image": [
	  {
		"publicUrl": "http:\/\/web.domain.test\/fileadmin\/media\/testimage.png",
		"properties": {
		  "title": null,
		  "alternative": null,
		  "description": null,
		  "link": null,
		  "linkData": null,
		  "mimeType": "image\/png",
		  "type": "image",
		  "filename": "testimage.png",
		  "originalUrl": "\/fileadmin\/media\/testimage.png",
		  "uidLocal": 3370,
		  "fileReferenceUid": 9518,
		  "size": "15 KB",
		  "dimensions": {
			"width": 500,
			"height": 300
		  },
		  "cropDimensions": {
			"width": 500,
			"height": 300
		  },
		  "crop": {
			"default": {
			  "cropArea": {
				"x": 0,
				"y": 0,
				"width": 1,
				"height": 1
			  },
			  "selectedRatio": "NaN",
			  "focusArea": null
			}
		  },
		  "autoplay": null,
		  "extension": null
		}
	  }
	],
	"link": {
	  "href": "\/demo\/link",
	  "target": null,
	  "class": null,
	  "title": null,
	  "linkText": "t3:\/\/page?uid=13",
	  "additionalAttributes": []
	}
  }
}

Configure individual fields of the FlexFormProcessor result. Same as overrideFields in DatabaseQueryProcessor, but for FlexFormProcessor (see also: TYPO3-Headless@bf8da47). Allows to convert typolinks, images, ...

## Example

10 = FriendsOfTYPO3\Headless\DataProcessing\FlexFormProcessor
10 {
  fieldName = pi_flexform
  as = flexform
  overrideFields {
	image = TEXT
	image {
	  dataProcessing {
		10 = FriendsOfTYPO3\Headless\DataProcessing\FilesProcessor
		10 {
		  references {
			table = tt_content
			fieldName = image
		  }
		  as = image
		}
	  }
	}
	link = TEXT
	link {
	  field = link
	  htmlSpecialChars = 1
	  typolink {
		parameter {
		  field = link
		}
		returnLast = result
	  }
	}
  }
}

Result

{
  "flexform": {
	"image": [
	  {
		"publicUrl": "http:\/\/web.domain.test\/fileadmin\/media\/testimage.png",
		"properties": {
		  "title": null,
		  "alternative": null,
		  "description": null,
		  "link": null,
		  "linkData": null,
		  "mimeType": "image\/png",
		  "type": "image",
		  "filename": "testimage.png",
		  "originalUrl": "\/fileadmin\/media\/testimage.png",
		  "uidLocal": 3370,
		  "fileReferenceUid": 9518,
		  "size": "15 KB",
		  "dimensions": {
			"width": 500,
			"height": 300
		  },
		  "cropDimensions": {
			"width": 500,
			"height": 300
		  },
		  "crop": {
			"default": {
			  "cropArea": {
				"x": 0,
				"y": 0,
				"width": 1,
				"height": 1
			  },
			  "selectedRatio": "NaN",
			  "focusArea": null
			}
		  },
		  "autoplay": null,
		  "extension": null
		}
	  }
	],
	"link": {
	  "href": "\/demo\/link",
	  "target": null,
	  "class": null,
	  "title": null,
	  "linkText": "t3:\/\/page?uid=13",
	  "additionalAttributes": []
	}
  }
}
@coveralls
Copy link

coveralls commented Feb 15, 2023

Pull Request Test Coverage Report for Build 4305780310

  • 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 61.597%

Totals Coverage Status
Change from base Build 4305600549: 0.0%
Covered Lines: 725
Relevant Lines: 1177

💛 - Coveralls

@lukaszuznanski lukaszuznanski self-requested a review February 17, 2023 12:57
@lukaszuznanski lukaszuznanski added the enhancement New feature or request label Feb 17, 2023
@lukaszuznanski lukaszuznanski merged commit 15c7043 into TYPO3-Headless:master Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants