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

No icon in frontend #42

Closed
martin-git-kristensen opened this issue Jan 2, 2024 · 5 comments
Closed

No icon in frontend #42

martin-git-kristensen opened this issue Jan 2, 2024 · 5 comments

Comments

@martin-git-kristensen
Copy link

My setup is typo3 11.5.33 with php 8.2.13 and bw_icons 2.1.7

In typo3 backend everything is fine - I can choose the icons for ex a header element - but when I use <f:image src="{data.tx_bwicons_icon}" /> in my fluid template for ex. header.html nothing shows up in frontend. When I debug: <f:debug>{data}</f:debug> there is nothing in {data} even if the header element has a icon in the backend and also in the tt_content database there is a field called tx_bwicons_icon and for the element there is a value: EXT:fontawesome/Resources/Public/Images/Icons/Fontawesome/algolia.svg
How can I get the icon to show up in the frontend?

@maikschneider
Copy link
Owner

Hey,

When I debug: <f:debug>{data}</f:debug> there is nothing in {data}

Is the whole data array empty? Please check again with <f:debug>{_all}</f:debug>. Make sure it really is the correct element template you are debugging.

but when I use <f:image src="{data.tx_bwicons_icon}" />

As soon as you have the value (EXT: fontawesome/...svg) in the frontend you should use the f:uri.resource-ViewHelper. The f:image ViewHelper is not suitable anymore for extension assets.

@maikschneider
Copy link
Owner

Try to add the debug statement into the Layout of your fluid_styled_content element. Maybe you are trying to access the data from a partial: Fluid styled content does not always pass all variables with arguments="{_all}", but only needed data, especially for the header partials.

@martin-git-kristensen
Copy link
Author

The whole data array is empty in the partial Header.html - and in the Layout Default.html the <f:debug>{data.tx_bwicons_icon}</f:debug> returns the right value.
Then I need the f:uri.resource in the partial - will it works there when the data array is empty in partial?

@maikschneider
Copy link
Owner

maikschneider commented Jan 2, 2024

You have to check the whole template inclusion path:

The entry point is your Templates/Header.html, Templates/Textmedia.html,... All of these use the Layouts/Default.html Layout. This layout file renders the Partials/Header/All.html partial with arguments="{_all}" - fine so far. However, this partials renders Partials/Header/Header.html with only a proportion of variables:

<f:render partial="Header/Header" arguments="{
                header: data.header,
                layout: data.header_layout,
                positionClass: '{f:if(condition: data.header_position, then: \'ce-headline-{data.header_position}\')}',
                link: data.header_link,
                default: settings.defaultHeaderType}" />

You could override this file and add icon: data.tx_bwicons_icon to the arguments. Then you can access the data via icon. Good luck! :)

@martin-git-kristensen
Copy link
Author

So very NICE - I have learned something today - this works and now I just have to puzzle with the f:uri.image or what img src to retrieve the {icon} - HAPPY NEWYEAR and thanks for your great help :-)

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

No branches or pull requests

2 participants