Control: Callback - 10quality/wpmvc-addon-administrator GitHub Wiki

The control used a field type to output and render custom HTML.

Usage

See example:

// Namespace and use statement...

class Settings extends Model
{
    // Class properties...

    protected function init()
    {
        // Other properties...

        $this->tabs = [
            'app' => [
                'title' => __( 'React App' ),
                'submit' => false,
                'show_title' => false,
                'fields' => [

                    uniqid() => [
                        'type' => 'callback',
                        'callback' => function( $settings_model, $field_id ) {
                            echo '<p>Custom HTML rendering.</p>';
                            echo '<pre style="background-color: #444444;color: #fff;padding: 10px;overflow: auto;">';
                            print_r( $settings_model );
                            echo '</pre>';
                        },
                    ],

                ],
            ],
        ];
    }
}
⚠️ **GitHub.com Fallback** ⚠️