Skip to content

Extension points

phil/block-editor-bundle

What an application implements, configures, overrides or listens to. Documents are checked by phil/ujo.

Ports

ImageUploader

Phil\BlockEditorBundle\Application\Upload\ImageUploader — where the images writers drop go, named by image_uploader. See Integrations.

MethodContract
upload(ImageUpload $image): UploadedImageReads the temporary file itself — what the browser said of it is never proof —, keeps it, and returns its URL, its size when known and the fields the application keeps; UploadRefused, whose message is shown to the writer, for a file it does not take

ReferenceSearch

Phil\BlockEditorBundle\Application\Reference\ReferenceSearch — the suggestions of the @ menu (mention_search) and of the [[ menu (link_search).

MethodContract
search(string $query, int $limit): iterable<Suggestion>Up to $limit suggestions for what was typed, possibly empty; each reference written kind:identifier; only what the writer may see, since the search runs under their session

Without a service named, the endpoint of that port answers 404.

Configuration and field options

PointHow
The block types and inline toolspreset, tools, inline_tools, globally or per field — see Configuration
The colours of the text colour toolcolors: tokens the site's stylesheet colours
The largest uploadmax_upload_bytes
Documents from elsewhereThe field's keep_foreign_blocks option: blocks outside the toolset kept and written back unchanged
LabelsThe field's messages option, or the messages key: any label replaced by its key
The endpointsThe field's upload_url, mentions_url and links_url; null turns one off

See Forms.

Form theme and stylesheet

@PhilBlockEditor/form/block_editor.html.twig draws the widget; the row, the errors and the help come from the application's own form theme, and form_widget() renders the editor alone. The stylesheet's custom properties are the contract of its look: --pbe-text, --pbe-accent and the others, redefined on .phil-block-editor — see JavaScript.

Events

EventDetailWhat a listener does
change on the input—Autosave, a dirty-form warning
phil--block-editor-bundle--editor:change{json}Reads the value written
phil--block-editor-bundle--editor:focus{id}Follows the block the writer is in

A collaboration controller dispatches phil-block-editor:apply, phil-block-editor:remove and phil-block-editor:lock on the editor's element to place, remove and close blocks — see JavaScript.