PHP code example of bernhardh / nova-icon-select

1. Go to this page and download the library: Download bernhardh/nova-icon-select library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bernhardh / nova-icon-select example snippets


use Bernhardh\NovaIconSelect\NovaIconSelect;

NovaIconSelect::make("Icon", "icon")
    ->setIconProvider(/* Instance or classname of an IconProvider */);

use Bernhardh\NovaIconSelect\NovaIconSelect;
use Bernhardh\NovaIconSelect\IconProviders\FontAwesomeIconProvider;

NovaIconSelect::make("Icon")
    ->setIconProvider(FontAwesomeIconProvider::class);

use Bernhardh\NovaIconSelect\NovaIconSelect;
use Bernhardh\NovaIconSelect\IconProvider;

NovaIconSelect::make("Icon")
    ->setIconProvider(IconProvider::make()->setOptions([
        [
            'label' => 'Custom icon 1',
            'value' => 'my-icons-1',
            'search' => ['foo']
        ],
        [
            'label' => 'Custom icon 2',
            'value' => 'my-icons-2',
        ],
        [
            'label' => 'Custom icon 2',
            'value' => 'my-icons-3',
            'search' => ['foo', 'bar']
        ],
    ]));

use Bernhardh\NovaIconSelect\NovaIconSelect;
use Bernhardh\NovaIconSelect\IconProvider;

NovaIconSelect::make("Icon", "icon")
    ->setIconProvider(
        IconProvider::make()->setOptions(config("iconset"))
    );

use Bernhardh\NovaIconSelect\IconProvider;

class MyCustomIconProvider extends IconProvider {
    
    public function __construct() {
        $this->setOptions([
            [
                'label' => 'Custom icon 1',
                'value' => 'my-icons-1',
                'search' => ['foo']
            ],
            [
                'label' => 'Custom icon 2',
                'value' => 'my-icons-2',
            ],
            [
                'label' => 'Custom icon 2',
                'value' => 'my-icons-3',
                'search' => ['foo', 'bar']
            ],
        ]);
    }
}

use Bernhardh\NovaIconSelect\NovaIconSelect;

NovaIconSelect::make("Icon")
    ->setIconProvider(MyCustomIconProvider::class);

[
    'label' => 'Custom icon 1',
    'value' => 'my-icons-1',
    'search' => ['foo', 'bar']
]

php artisan vendor:publish --provider="Bernhardh\NovaIconSelect\FieldServiceProvider"