[cv6] Node Icons & Tools

Add-ons [cv6] Node Icons & Tools 1.5.1 Release Candidate 3

Register & Get access to index
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.
Back
Top Bottom