PHP code example of khalin / nova4-indicator-field

1. Go to this page and download the library: Download khalin/nova4-indicator-field 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/ */

    

khalin / nova4-indicator-field example snippets


use Khalin\Fields\Indicator;

Indicator::make('Status'),

Indicator::make('Status')
    ->labels([
        'banned' => 'Banned',
        'active' => 'Active',
        'invited' => 'Invited',
        'inactive' => 'Inactive',
    ])

Indicator::make('Status')
    ->withoutLabels()

Indicator::make('Status')
    ->unknown('Unknown')

Indicator::make('Status')
    ->shouldHide('active')

Indicator::make('Status')
    ->shouldHide(['invited', 'requested'])

Indicator::make('Status')
    ->shouldHide(function($value) {
        return $value == 'inactive';
    })

Indicator::make('Status')
    ->shouldHideIfNo()

Indicator::make('Status')
    ->colors([
        'banned' => 'red',
        'active' => 'green',
        'invited' => 'blue',
        'inactive' => 'grey',
    ])

Indicator::make('Status')
    ->colors([
        '...' => '#ff0000',
        '...' => 'rgb(0, 255, 0)',
        '...' => 'rgba(0, 0, 0, 0.5)',
        '...' => 'hsl(120, 100%, 50%)',
        '...' => 'hsla(120, 100%, 50%, 0.5)',
        '...' => 'var(--success)',
    ])

Indicator::make('Status')
    ->colors([
        'yourstatus' => 'yourcolourname',
    ])