PHP code example of makraz / ux-quill

1. Go to this page and download the library: Download makraz/ux-quill 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/ */

    

makraz / ux-quill example snippets


use Makraz\QuillBundle\Form\QuillType;

public function buildForm(FormBuilderInterface $builder, array $options): void
{
    $builder
        ->add('content', QuillType::class)
    ;
}

$builder->add('content', QuillType::class, [
    'quill_options' => [
        'toolbar' => [
            [['header' => [1, 2, 3, false]]],
            ['bold', 'italic', 'underline', 'strike'],
            [['list' => 'ordered'], ['list' => 'bullet']],
            ['blockquote', 'code-block'],
            [['color' => []], ['background' => []]],
            [['align' => []]],
            ['link', 'image', 'video'],
            ['clean'],
        ],
    ],
]);

'toolbar' => [
    ['bold', 'italic', 'underline'],
    ['link'],
    ['clean'],
],

'toolbar' => [
    [['header' => [1, 2, 3, 4, 5, 6, false]]],
    ['bold', 'italic', 'underline', 'strike'],
    [['color' => []], ['background' => []]],
    [['list' => 'ordered'], ['list' => 'bullet']],
    [['indent' => '-1'], ['indent' => '+1']],
    [['align' => []]],
    ['blockquote', 'code-block'],
    ['link', 'image', 'video'],
    ['clean'],
],

'toolbar' => false,

$builder->add('content', QuillType::class, [
    'quill_options' => [
        'theme' => 'snow',
    ],
]);

$builder->add('content', QuillType::class, [
    'quill_options' => [
        'theme' => 'bubble',
    ],
]);

$builder->add('content', QuillType::class, [
    'quill_options' => [
        'theme' => 'snow',
        'placeholder' => 'Start writing your article...',
        'readOnly' => false,
        'minHeight' => 300,
        'toolbar' => [
            [['header' => [1, 2, 3, false]]],
            ['bold', 'italic', 'underline'],
            [['list' => 'ordered'], ['list' => 'bullet']],
            ['link', 'image'],
            ['clean'],
        ],
    ],
]);

use Makraz\QuillBundle\Form\QuillAdminField;

public function configureFields(string $pageName): iterable
{
    yield QuillAdminField::new('content');
}

yield QuillAdminField::new('content')
    ->setFormTypeOptions([
        'quill_options' => [
            'theme' => 'snow',
            'placeholder' => 'Write your content here...',
            'minHeight' => 400,
            'toolbar' => [
                [['header' => [1, 2, 3, false]]],
                ['bold', 'italic', 'underline', 'strike'],
                [['list' => 'ordered'], ['list' => 'bullet']],
                ['blockquote', 'code-block'],
                ['link', 'image'],
                ['clean'],
            ],
        ],
    ])
;