Jump to content

Recommended Posts

Posted

Is it possible to retrieve the icon of a field set in the admin? Eg. setting a "phone" icon to a "Phone" field in the admin, and then use this icon (name) in the templates?

Posted

This should do the trick!

$f = $fields->get("body");
echo '<i class="fa '.$f->icon.'"></i>';

PS make sure you load this on the page:

<link rel="stylesheet" href="/wire/templates-admin/styles/font-awesome/css/font-awesome.min.css" type="text/css">
  • Like 7
Posted

Thanks, it really did! Could have thought about the $fields variable myself :)

This is a great way to add icons using the admin, without any additional stuff.

Posted

Indeed, thanks!

I usually don't want to go shorter but this is an exception :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...