URL Field displays Clickable Icon

  • Vinny Hebert
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 2 weeks ago #167162 by Vinny Hebert
URL Field displays Clickable Icon was created by Vinny Hebert
I have a field that is going to display their LinkedIn profile.  Instead of displaying a link, I'd like it to display the LinkedIn font awesome icon that will be clickable instead of the URL.  Where would I do this?

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #167191 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic URL Field displays Clickable Icon
Hi Vinny

For this, you would need to customize the members list layout. The file you need to customize is components/com_osmembership/view/members/tmpl/default.php

Once the modification is done, you should move the modified file to template override templates/template_name/html/com_osmembership/members folder so that the change won't be lost when you update to future releases of the extension

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Vinny Hebert
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 2 weeks ago #167200 by Vinny Hebert
Replied by Vinny Hebert on topic URL Field displays Clickable Icon
This might be beyond me. I see where I need to make the change but not where it wouldn't affect the other fields. I'm not sure how to isolate that one field.

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #167204 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic URL Field displays Clickable Icon
You can determine the field base on id of that field. For example:

if ($field->id == 17)
{
// This is the code for the field with ID = 17
}
else
{
// This is the code for the field for other fields
}

Hope that helps

Tuan

Please Log in or Create an account to join the conversation.

  • Vinny Hebert
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 2 weeks ago #167213 by Vinny Hebert
Replied by Vinny Hebert on topic URL Field displays Clickable Icon
I've tried in several spots where I thought the field was being rendered and nothing changed.  The field shows the URL in both the Members List and the Member profile page.  In both, I'm trying to get 
Code:
<i class="fa-brands fa-linkedin" style="color: #0a66c2;">
wrapped with the url value to make the icon link.  I can't find where I do this.  I'm sorry.

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #167216 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic URL Field displays Clickable Icon
Hi Vinny

Please reply to the support ticket you created let me know ID of the field. I will try to help with this override

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Vinny Hebert
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 2 weeks ago #167220 by Vinny Hebert
Replied by Vinny Hebert on topic URL Field displays Clickable Icon
done

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #167221 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic URL Field displays Clickable Icon
I decided to implement the override in a different way. The override file is /templates/yootheme/html/com_osmembership/fieldlayout/fieldvalue.php

Here is the code to show you the idea:
Code:
if ($row->id == 16) { if ($rawValue && filter_var($rawValue, FILTER_VALIDATE_URL)) { ?> <a href="<?php echo $rawValue ?>"><i class="fa-brands fa-linkedin" style="color: #0a66c2;"></i></a> <?php } } else { echo $fieldValue; }

Regards,

Tuan
The following user(s) said Thank You: Vinny Hebert

Please Log in or Create an account to join the conversation.

  • Vinny Hebert
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 2 weeks ago #167232 by Vinny Hebert
Replied by Vinny Hebert on topic URL Field displays Clickable Icon
So instead of modifying the column in the Member List or the row in the profile, you altered the output of the field.  Perfect.  Thank you.

Please Log in or Create an account to join the conversation.

More
6 months 1 week ago #167243 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic URL Field displays Clickable Icon
Yes. It is possible to override output of the field, so I decided to make that override instead. By doing that, you won't loose any improvements to Members List in the future

Regards,

Tuan

Please Log in or Create an account to join the conversation.