Skip to content

[ticket/16413] Add an option to define CPF FontAwesome contact icon#5921

Open
rxu wants to merge 13 commits intophpbb:masterfrom
rxu:ticket/16413
Open

[ticket/16413] Add an option to define CPF FontAwesome contact icon#5921
rxu wants to merge 13 commits intophpbb:masterfrom
rxu:ticket/16413

Conversation

@rxu
Copy link
Contributor

@rxu rxu commented Mar 24, 2020

Checklist:

  • Correct branch: master for new features; 3.3.x & 3.2.x for fixes
  • Tests pass
  • Code follows coding guidelines: master, 3.3.x and 3.2.x
  • Commit follows commit message format

PHPBB3-16413.

image

image

Clipchamp.mp4

image

@hanakin
Copy link
Member

hanakin commented Mar 24, 2020

We are transitioning how we work with icons in 4.0. So this may need to be implemented different. I’m not exactly sure what this is yet. Give me sometime and I’ll get back to you after I have time to fully look things over.

Have a look at this pr #5753

@hanakin
Copy link
Member

hanakin commented Mar 24, 2020

ok so yeah not going to make it into 3.3, this will have to go into 4.0. It does require some changes to utilize the new icon system though. Not sure how yet. essentially we would have to expand this to default fields as well. With the ability to edit the icons for them in the ACP. so that we can simply just run a loop through them in the template to call the icon function. As for the acp changes. the js you are using will need to be redone as we are no longer using font-awsome alone. We are now supporting these format svg/png/iconify/font for icons. This means you would have to serve back the icon in one of these formats based on another field. It would still work very similar in that the name of the icon would be the name provided in the icon field. For reference the loading of an icon looks like this respectively.

SVG: load based on input.svg
PNG: load based on input.png
ICONIFY: <i class="iconify o-icon-src-iconify o-icon" data-icon="{{ input }}" data-inline="true"></i>
FONTAWSOME: <i class="o-icon o-icon-font fa-{{ input }} fw etc

you can reference the icon function here: https://github.com/phpbb/phpbb/pull/5545/files

@rxu
Copy link
Contributor Author

rxu commented Mar 25, 2020

So am I getting it right that this PR is ok for 3.3 but for 4.0 there should be another one with the use of new icon system? @hanakin

@rxu rxu closed this Mar 25, 2020
@rxu rxu reopened this Mar 25, 2020
@hanakin
Copy link
Member

hanakin commented Mar 25, 2020

No there. It will not work for 3.3

@rxu
Copy link
Contributor Author

rxu commented Mar 25, 2020

I see, so 2 different PRs for 3.3 and 4.0? 😃

@hanakin
Copy link
Member

hanakin commented Mar 25, 2020

No it will no5 make it into 3.3 just work on one for 4.0

@rxu
Copy link
Contributor Author

rxu commented Mar 25, 2020

Oh. Regret, so postponed for several years ahead :)
But whatever, ok then. I should wait until PRs mentioned above got merged though.

@rxu rxu changed the base branch from 3.3.x to master March 25, 2020 02:18
@ghost
Copy link

ghost commented Mar 25, 2020

If you don't mind me asking, but why is it not possible for 3.3?
Cause it sounds like it has to be implemented in some fashion for 4.0 anyway, then atleast with this there is a basis for it. Which might have to be altered and adjusted, but the groundwork has been done.

@hanakin
Copy link
Member

hanakin commented Mar 25, 2020

Ok let me put it another way. This branch is for 3.3.x released which are security and bug fixes only. All new features need to go against master branch. Regardless of what version we are calling it be it 3.4 or 4.0. Which means that he can take advantage of the icon function. Which means no need to do a version without.

@rxu
Copy link
Contributor Author

rxu commented Mar 27, 2020

Since there's no way to automatically detect icon type in 4.0, there's no way to implement this feature.

@hanakin
Copy link
Member

hanakin commented Mar 27, 2020

What do You mean by detect icon type? Why do you need to do that?

@rxu
Copy link
Contributor Author

rxu commented Mar 27, 2020

Because only icon name input is not enough to render the icon now.

@hanakin
Copy link
Member

hanakin commented Mar 27, 2020

So? Add a field for type

@rxu
Copy link
Contributor Author

rxu commented Mar 27, 2020

2 new DB fields for a single icon? :) Nice.
I'll think about it.

@hanakin
Copy link
Member

hanakin commented Mar 27, 2020

Well you do not need two, you can repurpose the name field as the icon field

@ghost
Copy link

ghost commented Mar 27, 2020

Perhaps it's possible to store the icon name the same way as Iconify determines it:
fa:user
mdi:user
svg:user

@hanakin
Copy link
Member

hanakin commented Mar 27, 2020

Well you have to do that anyway if your using iconify. But you mean for svg and png? Not sure how that would work for fonts. font-fa

@rxu
Copy link
Contributor Author

rxu commented Mar 27, 2020

Perhaps it's possible to store the icon name the same way as Iconify determines it

I don't think phpBB is going to use it like that, is it?

@hanakin
Copy link
Member

hanakin commented Mar 27, 2020

Not sure who you are responding to. We will do whatever makes the most sense to work. The default icons will be served via iconify where possible. We will have some custom icons. If we can not get them into iconify then they would be served via svg

@rxu
Copy link
Contributor Author

rxu commented Mar 27, 2020

I don't think I understand what are you talking about. Looking at #5545 I see almost nothing from described at https://iconify.design.
So I have no idea what are you offering me to implement in this PR, sorry. I guess I'll hold it up to some 4.0-beta or so, thanks.

@rxu rxu closed this Mar 27, 2020
@ghost
Copy link

ghost commented Mar 27, 2020

There are various types that the {{ Icon() }} function takes: font, iconify, png, svg.
You want to provide an interface in the ACP for selecting an icon for a custom profile field.
If you want to use FontAwesome icons for the contact icons, you can add the FontAwesome picker as you're doing here. Then in the styles you'll be able to call {{ Icon('font', '<the icon>') }}.
If you want to allow more than just FA icons, you can add a 'select icon type' dropdown before the input. So users can select from font | iconify | png | svg. And then still insert their desired icon. You can store this in a single column in the db, concatenating them with colon :, eg: font:user. Then when displaying the icon for the profile field, you'll be able to grab the part before the first colon and use that as your icon type: {{ Icon('font', 'user') }}. Only thing then would be that iconify icons will have a 2nd colon that will need to be handled, eg: iconify:mdi:user.

@hanakin
Copy link
Member

hanakin commented Mar 27, 2020

That created the icon function. Iconify works by adding a js file to the footer of the new theme. It it looks for an html element with the class iconify and a data attribute with the icon library:name. We have not added any js yet if that is what you are asking. The or for switching over the prosIlver is one will do that, but it’s not merged yet.

#5753

@hanakin
Copy link
Member

hanakin commented Mar 27, 2020 via email

@rxu rxu reopened this May 12, 2025
@rxu rxu marked this pull request as draft May 12, 2025 04:32
@rxu rxu force-pushed the ticket/16413 branch 3 times, most recently from 01f0a06 to 599cb06 Compare May 20, 2025 06:54
@rxu rxu marked this pull request as ready for review May 20, 2025 08:12
@rxu rxu closed this Oct 2, 2025
@rxu rxu reopened this Oct 2, 2025
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