class Medias extends BaseFormField (View source)

Traits

Properties

bool $renderForBlocks from  RenderForBlocks
protected bool $translated from  IsTranslatable
protected int|null $max from  HasMax
protected string|null $fieldNote from  HasFieldNote
protected bool $buttonOnTop from  CanHaveButtonOnTop
protected bool $withAddInfo
protected bool $withVideoUrl
protected bool $withCaption
protected int|null $altTextMaxLength
protected int|null $captionMaxLength
protected array $extraMetadatas
protected int $widthMin
protected int $heightMin
protected bool $activeCrop

Methods

renderForBlocks(bool $renderForBlocks = true)

No description

bool
forBlocks()

No description

__construct(string $component, string|null $name = null, string|null $label = null, string|null $note = null, bool|null $required = false, bool|null $disabled = false, mixed $default = null, mixed $connectedTo = null, array $mandatoryProperties = [])

No description

static BaseFormField
make()

No description

name(string $name)

Set the name of the field, if no label is set yet, this method will also update that.

default(mixed $default)

No description

label(string $label)

Set the label of the field, you can use twillTrans('') Laravel translatable strings here.

note(string $note)

Add a note to the field to display on the form.

required(bool $required = true)

Marks the field as mandatory, however you still need to add validation rules.

disabled(bool $disabled = true)

Marks the field as disabled.

connectedTo(string $fieldName, mixed $fieldValues, array $options = [])

No description

View
render()

No description

array
getAdditionalConstructorArguments()

In render we dynamically build the constructor arguments.

translatable(bool $translatable = true)

Makes the field translatable.

max(int $max)

Sets the max amount of items.

from  HasMax
fieldNote(string $fieldNote)

Adds a note.

buttonOnTop(bool $buttonOnTop = true)

Shows the browse button above instead of below the list of items.

withoutAddInfo(bool $withoutAddInfo = true)

Disables the additional metadata input fields.

withoutVideoUrl(bool $withoutVideoUrl = true)

Removes the video url field from the additional info section.

withoutCaption(bool $withoutCaption = true)

Removes the caption field from the additional info section.

altTextMaxLength(bool $altTextMaxLength)

Set the max length of the alt field.

captionMaxLength(int $captionMaxLength)

Set the max length of the caption field.

extraMetadatas(array $extraMetadatas)

Define custom extra metadata.

minWidth(int $minWidth)

The minimum width of the image.

minHeight(int $minHeight)

The minimum height of the image.

hideActiveCrop(bool $hideActiveCrop = true)

Hide the cropper.

Details

RenderForBlocks renderForBlocks(bool $renderForBlocks = true)

No description

Parameters

bool $renderForBlocks

Return Value

RenderForBlocks

bool forBlocks()

No description

Return Value

bool

protected __construct(string $component, string|null $name = null, string|null $label = null, string|null $note = null, bool|null $required = false, bool|null $disabled = false, mixed $default = null, mixed $connectedTo = null, array $mandatoryProperties = [])

No description

Parameters

string $component
string|null $name
string|null $label
string|null $note
bool|null $required
bool|null $disabled
mixed $default
mixed $connectedTo
array $mandatoryProperties

static BaseFormField make()

No description

Return Value

BaseFormField

BaseFormField name(string $name)

Set the name of the field, if no label is set yet, this method will also update that.

Parameters

string $name

Return Value

BaseFormField

BaseFormField default(mixed $default)

No description

Parameters

mixed $default

Return Value

BaseFormField

BaseFormField label(string $label)

Set the label of the field, you can use twillTrans('') Laravel translatable strings here.

Parameters

string $label

Return Value

BaseFormField

BaseFormField note(string $note)

Add a note to the field to display on the form.

Parameters

string $note

Return Value

BaseFormField

BaseFormField required(bool $required = true)

Marks the field as mandatory, however you still need to add validation rules.

Parameters

bool $required

Return Value

BaseFormField

BaseFormField disabled(bool $disabled = true)

Marks the field as disabled.

There might be some fields not supporting this.

Parameters

bool $disabled

Return Value

BaseFormField

connectedTo(string $fieldName, mixed $fieldValues, array $options = [])

No description

Parameters

string $fieldName
mixed $fieldValues
array $options

View render()

No description

Return Value

View

protected array getAdditionalConstructorArguments()

In render we dynamically build the constructor arguments.

In exceptional cases such as browser we have more conditionals and we can use this method to set those.

Return Value

array

IsTranslatable translatable(bool $translatable = true)

Makes the field translatable.

Parameters

bool $translatable

Return Value

IsTranslatable

HasMax max(int $max)

Sets the max amount of items.

Parameters

int $max

Return Value

HasMax

HasFieldNote fieldNote(string $fieldNote)

Adds a note.

Parameters

string $fieldNote

Return Value

HasFieldNote

CanHaveButtonOnTop buttonOnTop(bool $buttonOnTop = true)

Shows the browse button above instead of below the list of items.

Parameters

bool $buttonOnTop

Return Value

CanHaveButtonOnTop

Medias withoutAddInfo(bool $withoutAddInfo = true)

Disables the additional metadata input fields.

Parameters

bool $withoutAddInfo

Return Value

Medias

Medias withoutVideoUrl(bool $withoutVideoUrl = true)

Removes the video url field from the additional info section.

Parameters

bool $withoutVideoUrl

Return Value

Medias

Medias withoutCaption(bool $withoutCaption = true)

Removes the caption field from the additional info section.

Parameters

bool $withoutCaption

Return Value

Medias

Medias altTextMaxLength(bool $altTextMaxLength)

Set the max length of the alt field.

Parameters

bool $altTextMaxLength

Return Value

Medias

Medias captionMaxLength(int $captionMaxLength)

Set the max length of the caption field.

Parameters

int $captionMaxLength

Return Value

Medias

Medias extraMetadatas(array $extraMetadatas)

Define custom extra metadata.

Parameters

array $extraMetadatas

Return Value

Medias

See also

https://twillcms.com/docs/form-fields/medias.html#content-extra-metadatas

Medias minWidth(int $minWidth)

The minimum width of the image.

Parameters

int $minWidth

Return Value

Medias

Medias minHeight(int $minHeight)

The minimum height of the image.

Parameters

int $minHeight

Return Value

Medias

Medias hideActiveCrop(bool $hideActiveCrop = true)

Hide the cropper.

Parameters

bool $hideActiveCrop

Return Value

Medias