Adding an icon to the admin form

Issues related to forms.
Post Reply
Kevin
 
 
Posts: 15
Joined: Wed Mar 08, 2023 8:58 pm

Adding an icon to the admin form

Post by Kevin »

Hello,

I want to add by php a new icon apart from the default icons that alredy exists (the icon.delete and icon.edit). Adding a mail icon next to it, nevertheless the webpage for svg creators does not work properly with the php file that is created from the wysiwyg program, how are these 2 icons created and how i can make my third icon visible in the form?

default icon edit (background part as this is the icon image):

background: url('data:image/svg+xml,%3csvg%20style%3d%22fill:%23000000%22%20viewBox%3d%220%200%2040%2040%22%20version%3d%221.1%22%20xmlns%3d%22http://www.w3.org/2000/svg%22%3e%0d%0a%20%20%2 ... g%3e%0d%0a') no-repeat center center;

my intent to create a mail icon:

background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' width='256' height='256' viewBox='0 0 256 256' xml:space='preserve'%3E%3Cdefs%3E%3C/defs%3E%3Cg style='stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;' transform='translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)' %3E%3Cpath d='M 80.89 78.772 H 9.11 c -5.023 0 -9.11 -4.087 -9.11 -9.11 V 20.338 c 0 -5.023 4.087 -9.11 9.11 -9.11 h 71.78 c 5.023 0 9.11 4.087 9.11 9.11 v 49.324 C 90 74.686 85.913 78.772 80.89 78.772 z M 9.11 17.228 c -1.715 0 -3.11 1.396 -3.11 3.11 v 49.324 c 0 1.715 1.395 3.11 3.11 3.11 h 71.78 c 1.715 0 3.11 -1.396 3.11 -3.11 V 20.338 c 0 -1.715 -1.396 -3.11 -3.11 -3.11 H 9.11 z' style='stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;' transform=' matrix(1 0 0 1 0 0) ' stroke-linecap='round' /%3E%3Cpath d='M 45 55.427 c -5.408 0 -10.599 -2.292 -14.242 -6.288 L 2.493 18.125 l 4.435 -4.042 l 28.265 31.013 c 2.545 2.792 6.028 4.331 9.807 4.331 c 3.779 0 7.262 -1.538 9.808 -4.331 l 28.266 -31.013 l 4.434 4.042 L 59.241 49.138 C 55.599 53.135 50.408 55.427 45 55.427 z' style='stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;' transform=' matrix(1 0 0 1 0 0) ' stroke-linecap='round' /%3E%3Crect x='-0.96' y='57.16' rx='0' ry='0' width='38.98' height='6' style='stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;' transform=' matrix(0.7053 -0.7089 0.7089 0.7053 -37.1881 30.8639) '/%3E%3Crect x='68.47' y='40.67' rx='0' ry='0' width='6' height='38.98' style='stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;' transform=' matrix(0.709 -0.7053 0.7053 0.709 -21.628 67.9146) '/%3E%3C/g%3E%3C/svg%3E") no-repeat center center;

As you can see the is a huge difference between the way these two icons are refered.

Thanks.
User avatar
Pablo
 
Posts: 23434
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Adding an icon to the admin form

Post by Pablo »

Note that I cannot help you with custom coding. I cannot teach you how to write code.

But if you want include your own SVG as background image then you will need to encode it.
For example:
https://codepen.io/shshaw/pen/Mjayzz
Post Reply