class FroalaEditorBuilder

Class FroalaEditorBuilder

This builder class is used for building the froala editor data structure which is used by the client side to create a froala object.

Properties

protected string $domId
protected FroalaOption[] $options
protected FroalaInsertGroup[] $previewInsertGroups
protected FroalaInsertGroup[] $attachmentInsertGroups
protected Controller|null $mod
protected DocumentIndex|null $documentIndex
protected bool $useMentions
protected bool $useSubmitOnCtrlEnter
protected string $allowHTML
protected bool $useTags
protected string $toolbarSet
protected bool $toolbarAttached

Uses standard toolbar or inline toolbar?

Methods

__construct(string $domId)

FroalaEditorBuilder constructor.

string
buildJs()

No description

createAttachmentInsertGroup(string $key, string $label, string|null $icon = null)

Creates a new toolbar dropdown menu with custom entries.

createPreviewInsertGroup(string $key, string $label, string|null $icon = null)

Creates a new toolbar dropdown menu with custom entries.

string
getOptions()

Get Options as JSON Object StringFormat

array
getToolbarButtons()

Returns the setup of the toolbar based on the property simpleToolbar which defines the features used by the toolbar. If simpleToolbar is used, this method returns a setup which contains less buttons.

array
getToolbarButtonsReduced(int $visibleButtons = 5)

Reduce the amount of visible Toolbar Buttons for smaller versions of the standard toolbar

void
setPluginInsertData(array $pluginInsertData)

Sichtweise: Froala / Insert Plugin Aufgabe:Konvertierung von Daten in Plugin spezifische Formatierung (JSON, JS, API?).

withAllowHTML(string $inputMode = 'full')

The Input mode can be full, image-only, none

withColorsText(array $colors, bool $replace = false)

Add to or replace the color picker colors for text and background color

withDocumentIndex(DocumentIndex|null $documentIndex)

No description

withDocumentSelector($documentSelector)

No description

withMentions(bool $bool)

No description

withMod(Controller|null $mod)

No description

withOptions(FroalaOption ...$options)

Adds a new option to froala editor.

withSubmitOnCtrlEnter(bool $bool)

If enabled pressing CTRL+ENTER in the textarea will submit the form

withTags(bool $bool)

Enables inline #tag Tags incl. autosuggest

withToolbarSet(string $toolbarSet, bool $attachedToolbar = true)

Sets the set of toolbar buttons used for editor.

Details

at line 85
__construct(string $domId)

FroalaEditorBuilder constructor.

Parameters

string $domId

at line 384
string buildJs()

No description

Return Value

string

at line 214
FroalaInsertGroup createAttachmentInsertGroup(string $key, string $label, string|null $icon = null)

Creates a new toolbar dropdown menu with custom entries.

Parameters

string $key
string $label
string|null $icon

Return Value

FroalaInsertGroup

at line 227
FroalaInsertGroup createPreviewInsertGroup(string $key, string $label, string|null $icon = null)

Creates a new toolbar dropdown menu with custom entries.

Parameters

string $key
string $label
string|null $icon

Return Value

FroalaInsertGroup

at line 235
string getOptions()

Get Options as JSON Object StringFormat

Return Value

string

e.g. }

at line 421
protected array getToolbarButtons()

Returns the setup of the toolbar based on the property simpleToolbar which defines the features used by the toolbar. If simpleToolbar is used, this method returns a setup which contains less buttons.

Return Value

array

at line 453
protected array getToolbarButtonsReduced(int $visibleButtons = 5)

Reduce the amount of visible Toolbar Buttons for smaller versions of the standard toolbar

Parameters

int $visibleButtons

Return Value

array

at line 598
void setPluginInsertData(array $pluginInsertData)

Sichtweise: Froala / Insert Plugin Aufgabe:Konvertierung von Daten in Plugin spezifische Formatierung (JSON, JS, API?).

..

Parameters

array $pluginInsertData

[['group' => 'Name', 'link' => ['label'=>'', 'snippet' =>'' ], 'preview' => ['label'=>'', 'snippet' =>'']]]

Return Value

void

at line 200
FroalaEditorBuilder withAllowHTML(string $inputMode = 'full')

The Input mode can be full, image-only, none

Parameters

string $inputMode

Return Value

FroalaEditorBuilder

at line 161
withColorsText(array $colors, bool $replace = false)

Add to or replace the color picker colors for text and background color

Parameters

array $colors

an array of hex colors, see froala docs ['#ffffff', '#00ff23', ...]

bool $replace

if true $colors will replace the default array, otherwise the colors are just appended

at line 125
FroalaEditorBuilder withDocumentIndex(DocumentIndex|null $documentIndex)

No description

Parameters

DocumentIndex|null $documentIndex

Return Value

FroalaEditorBuilder

at line 131
FroalaEditorBuilder withDocumentSelector($documentSelector)

No description

Parameters

$documentSelector

Return Value

FroalaEditorBuilder

at line 141
FroalaEditorBuilder withMentions(bool $bool)

No description

Parameters

bool $bool

Return Value

FroalaEditorBuilder

at line 115
FroalaEditorBuilder withMod(Controller|null $mod)

No description

Parameters

Controller|null $mod

Return Value

FroalaEditorBuilder

at line 105
FroalaEditorBuilder withOptions(FroalaOption ...$options)

Adds a new option to froala editor.

Parameters

FroalaOption ...$options

Return Value

FroalaEditorBuilder

at line 190
FroalaEditorBuilder withSubmitOnCtrlEnter(bool $bool)

If enabled pressing CTRL+ENTER in the textarea will submit the form

Parameters

bool $bool

Return Value

FroalaEditorBuilder

at line 150
FroalaEditorBuilder withTags(bool $bool)

Enables inline #tag Tags incl. autosuggest

Parameters

bool $bool

Return Value

FroalaEditorBuilder

at line 408
FroalaEditorBuilder withToolbarSet(string $toolbarSet, bool $attachedToolbar = true)

Sets the set of toolbar buttons used for editor.

Parameters

string $toolbarSet

One of the FormTextarea::WYSIWYG* constants

bool $attachedToolbar

True = normal Toolbar, False = Inline Toolbar (e.g. for comments)

Return Value

FroalaEditorBuilder