<i class="locker"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>locker</title>
<g id="locker">
<path d="M22,54H2a1,1,0,0,1-1-1V9A1,1,0,0,1,2,8H22a1,1,0,0,1,1,1V53A1,1,0,0,1,22,54ZM3,52H21V10H3Z" />
<path d="M42,54H22a1,1,0,0,1-1-1V9a1,1,0,0,1,1-1H42a1,1,0,0,1,1,1V53A1,1,0,0,1,42,54ZM23,52H41V10H23Z" />
<path d="M62,54H42a1,1,0,0,1-1-1V9a1,1,0,0,1,1-1H62a1,1,0,0,1,1,1V53A1,1,0,0,1,62,54ZM43,52H61V10H43Z" />
<path d="M4,56a1,1,0,0,1-1-1V53a1,1,0,0,1,2,0v2A1,1,0,0,1,4,56Z" />
<path d="M20,56a1,1,0,0,1-1-1V53a1,1,0,0,1,2,0v2A1,1,0,0,1,20,56Z" />
<path d="M24,56a1,1,0,0,1-1-1V53a1,1,0,0,1,2,0v2A1,1,0,0,1,24,56Z" />
<path d="M40,56a1,1,0,0,1-1-1V53a1,1,0,0,1,2,0v2A1,1,0,0,1,40,56Z" />
<path d="M44,56a1,1,0,0,1-1-1V53a1,1,0,0,1,2,0v2A1,1,0,0,1,44,56Z" />
<path d="M60,56a1,1,0,0,1-1-1V53a1,1,0,0,1,2,0v2A1,1,0,0,1,60,56Z" />
<path d="M17,49H7a1,1,0,0,1,0-2H17a1,1,0,0,1,0,2Z" />
<path d="M17,45H7a1,1,0,0,1,0-2H17a1,1,0,0,1,0,2Z" />
<path d="M17,41H7a1,1,0,0,1,0-2H17a1,1,0,0,1,0,2Z" />
<path d="M18,23H6a1,1,0,0,1-1-1V14a1,1,0,0,1,1-1H18a1,1,0,0,1,1,1v8A1,1,0,0,1,18,23ZM7,21H17V15H7Z" />
<path d="M18,33a1,1,0,0,1-1-1V30a1,1,0,0,1,2,0v2A1,1,0,0,1,18,33Z" />
<path d="M37,49H27a1,1,0,0,1,0-2H37a1,1,0,0,1,0,2Z" />
<path d="M37,45H27a1,1,0,0,1,0-2H37a1,1,0,0,1,0,2Z" />
<path d="M37,41H27a1,1,0,0,1,0-2H37a1,1,0,0,1,0,2Z" />
<path d="M38,23H26a1,1,0,0,1-1-1V14a1,1,0,0,1,1-1H38a1,1,0,0,1,1,1v8A1,1,0,0,1,38,23ZM27,21H37V15H27Z" />
<path d="M38,33a1,1,0,0,1-1-1V30a1,1,0,0,1,2,0v2A1,1,0,0,1,38,33Z" />
<path d="M57,49H47a1,1,0,0,1,0-2H57a1,1,0,0,1,0,2Z" />
<path d="M57,45H47a1,1,0,0,1,0-2H57a1,1,0,0,1,0,2Z" />
<path d="M57,41H47a1,1,0,0,1,0-2H57a1,1,0,0,1,0,2Z" />
<path d="M58,23H46a1,1,0,0,1-1-1V14a1,1,0,0,1,1-1H58a1,1,0,0,1,1,1v8A1,1,0,0,1,58,23ZM47,21H57V15H47Z" />
<path d="M58,33a1,1,0,0,1-1-1V30a1,1,0,0,1,2,0v2A1,1,0,0,1,58,33Z" />
</g>
</svg></i>
{% set className = className ? className ~ ' ' : '' %}
{% set attributes = className ~ icon | trim %}
{% set insert = true %}
{% if iconType is empty or iconType == 'custom' %}
<i class="{{ attributes }}">{% if insert is defined and insert == true %}{{ source('@customIcons/' ~ icon ~ '.svg') }}{% endif %}</i>
{% elseif iconType is not empty or iconType == 'iconoir' %}
<i class="{{ attributes }}">{% if insert is defined and insert == true %}{{ source('@icons/' ~ icon ~ '.svg') }}{% endif %}</i>
{% endif %}
{
"icon": "locker"
}
<?php
namespace Theme\Views\Atoms\icon;
use ACFToolkit\Traits\SetWrapperWidth;
use ACFToolkit\Types\CustomAtom;
class Icon extends CustomAtom
{
use SetWrapperWidth;
public string $name = 'icon';
public string $label = 'Icon';
public int $needsJs = 0;
public int $needsVue = 1;
public int $needsVueInitialisation = 0;
public function __construct($name = '', $title = '', $children = [])
{
parent::__construct($name, $title);
$this->addChildren(array_merge($children, [
]));
}
public function getChoices()
{
$customIcons = get_template_directory().'/resources/Views/Assets/dist/custom-icons/*.svg';
$result = [];
$files = glob($customIcons);
foreach($files as $file) {
$filename = basename($file, '.svg');
$result[$filename] = $filename;
}
return $result;
}
}
<?php
namespace Theme\Views\Atoms\icon;
use ACFToolkit\ViewModels\BaseViewModel;
class IconViewModel extends BaseViewModel
{
}
i {
display: inline-block;
width: 26px;
svg {
width: 100%;
vertical-align: top;
}
&.sm {
width: 20px;
}
&.md {
width: 40px;
}
&.lg {
width: 50px;
}
&.xl {
width: 60px;
}
&.star--filled {
svg {
g {
fill: theme('colors.primary');
}
}
}
&.logo {
svg {
g {
fill: theme('colors.primary');
}
}
}
&.logo--white {
svg {
g {
fill: #fff;
}
}
}
&.logo_subline {
svg {
g {
fill: theme('colors.primary');
}
}
}
&.logo_subline--white {
svg {
g {
fill: #fff;
}
}
}
&.logo_subline-subline--accent {
svg {
g {
fill: theme('colors.primary');
&#subline {
fill: theme('colors.accent');
}
}
}
}
&.logo_subline--white-subline--accent {
svg {
g {
fill: #fff;
&#subline {
fill: theme('colors.accent');
}
}
}
}
&.search {
width: 24px;
height: 24px;
}
}
<template>
<i
:class="getTypeClass + '-' + icon + ' ' + className"
v-html="iconSource"
:title="title"
v-if="iconSource"
></i>
</template>
<script>
import IconService from '../../Assets/src/js/services/IconService';
export default {
props: {
className: {
type: String,
default: ''
},
icon: {
type: String,
},
title: {
type: String
},
type: {
type: String,
default: 'custom'
}
},
data: () => {
return {
iconSource: null
}
},
computed: {
getTypeClass(){
return this.type === 'custom' ? 'custom' : 'iconoir'
}
},
async created(){
const {data} = this.type === 'custom' ?
await IconService.getCustom(this.icon) :
await IconService.getIconoir(this.icon)
this.iconSource = data
}
}
</script>
<style>
*[class^="iconoir-"], *[class*=" iconoir-"] {
display: inline-block;
}
</style>
{% include '@atoms/icon/icon.twig' with {
icon: 'icon'
} only %}Fields