How to add this to non default node types?
In fact that I can't add the base code to the abstract, you need to perform the following in your (admin) controller:
PHP:
protected function nodeSaveProcess(\XF\Entity\Node $node)
{
$iconData = $this->filter(
['node' => [
'cv6_icon_type' => 'int',
'cv6_icon' => 'str',
'cv6_image_path' => 'str'
]]
);
$formAction = parent::nodeSaveProcess($node);
$formAction->setup(function () use ($node, $iconData) {
$node->cv6_icon_type = $iconData['node']['cv6_icon_type'];
$node->cv6_icon = $iconData['node']['cv6_icon'];
$node->cv6_image_path = $iconData['node']['cv6_image_path'];
});
return $formAction;
}
Then add the macro to the edit form:
HTML:
<xf:macro template="cv6_ni_macros" name="cv6_icon" arg-node="{$node}" />
or, for 2.2 notation
HTML:
<xf:macro name="cv6_ni_macros::cv6_icon" arg-node="{$node}" />
You may to modify the parameter $node to your variable.
Then its saved in the database.
To load the Logo in your frontend you can use the macros inside the templae
cv6_nodeicon_macros
Why is my SVG not switching colors?
If your SVG is not using the default Node Icon Colors, please check the following:
- Is the SVG Imnject enabled in the Settings?
- Do you chooses the SVG Inject option in your Node Settings?
- Are there no colors defined in the SVG? You need a SCG without styling options for fill and the other options.
Can I use FontAwesome Duotone Icons?
Yes, you can use every Foont Awesome style. Just add the class inside the field. The second Color will even change with the read/unread color.
If want to make your users crazy, you can add the fa-spin class to the icon to create a rotating icon.
View attachment 251902
Do you support Kirby Font Awesome Manager?
Yes. Enter in the Field Additional Entities the following: