netresearch / t3x-rte_ckeditor_image

Image support in CKEditor for the TYPO3 ecosystem
GNU Affero General Public License v3.0
56 stars 65 forks source link

ImageRenderingController::getLazyLoadingConfiguration() throws error #217

Closed thorstenlbk closed 1 year ago

thorstenlbk commented 1 year ago

Bug description if I add an image to a rich text field I get an error in the frontend.

Steps to reproduce To reproduce the problem:

I installed the extension on an existing site according to the README.md

  1. composer req netresearch/rte-ckeditor-image
  2. Imported the configuration in my already existing and working custom.yaml
    • { resource: "EXT:rte_ckeditor_image/Configuration/RTE/Plugin.yaml" }
  3. I included the Static Template file before the Fluid Styled content
  4. I inserted an image in the text field with the plugin. It is working in the backend.
  5. If I view the page in the frontend I get an error: Netresearch\RteCKEditorImage\Controller\ImageRenderingController::getLazyLoadingConfiguration(): Return value must be of type ?array, string returned

Expected behavior That I can see the image in the text.

The function getLazyLoadingConfiguration is just one line and has to return an array or null:

private function getLazyLoadingConfiguration(): ?array { return $GLOBALS['TSFE']->tmpl->setup['lib.']['contentElement.']['settings.']['media.']['lazyLoading'] ?? null; }

lazyLoading gets set in typo3/sysext/fluid_styled_content/Configuration/TypoScript/Helper/ContentElement.typoscript with the value of the constant {$styles.content.image.lazyLoading}. This constant is initialized in typo3/sysext/fluid_styled_content/Configuration/TypoScript/constants.typoscript with the string value 'lazy'. So the getLazyLoadingConfiguration function needs to return a string or null.

It seems the error was introduced in commit 4ddb62d1df5b2c45bb4d60217f0a9dc2cc67cde2

Screenshots or logs

Screenshot 2023-02-02 at 19-11-31 TYPO3 Exception

Environment

Documentation Have you checked the readme/documentation?

Gitsko commented 1 year ago

@thorstenlbk, the problem should be fixed in version 11.0.8