Block
class Block (View source)
Constants
SOURCE_APP |
|
SOURCE_TWILL |
|
SOURCE_CUSTOM |
|
SOURCE_VENDOR |
|
TYPE_BLOCK |
|
TYPE_SETTINGS |
|
TYPE_REPEATER |
|
PREG_REPLACE_INNER |
|
Properties
string | $title | ||
string | $titleField | ||
bool | $hideTitlePrefix | ||
string | $trigger | ||
string|null | $selectTrigger | For repeaters only: The select existing button text. |
|
string | $source | ||
string | $name | ||
string | $group | ||
string | $type | ||
string | $icon | ||
bool | $compiled | ||
string | $component | ||
int | $max | ||
bool | $isNewFormat | ||
SplFileInfo | $file | ||
string | $fileName | ||
string | $renderNamespace | ||
string | $contents | ||
array | $rules | ||
array | $rulesForTranslatedFields | ||
RenderData|null | $renderData | Renderedata. | |
TwillBlockComponent | $componentClass | ||
InlineRepeater|null | $inlineRepeater |
Methods
No description
Make a block instance out of arguments.
No description
Gets the first match being a block or repeater.
No description
No description
Block constructor.
Gets the form data. This is only called once and not per create.
No description
No description
No description
Checks both the blade file or helper class for validation rules. Returns in order the first one with data.
Checks both the blade file or helper class for validation rules. Returns in order the first one with data.
Parse a string property directive in the form of @twillTypeProperty('value')
.
Parse an array property directive in the form of @twillTypeProperty([...])
and pass the result to a given callback.
Parse a mixed property directive in the form of @twillTypeProperty('value', [...])
and pass the result to a given callback.
No description
No description
No description
No description
No description
No description
Details
static Block
forComponent(string $componentClass)
No description
static Block
make($file, $type, $source, $name = null, string $renderNamespace = null)
Make a block instance out of arguments.
Block
newInstance()
No description
static Block|null
findFirstWithType(string $type)
Gets the first match being a block or repeater.
static Block
getForType(string $type, bool $repeater = false)
No description
static Block|null
getForComponent(string $type, bool $repeater = false)
No description
final
__construct(SplFileInfo|null $file, string|null $type, $source, $name = null, string|null $renderNamespace = null, string|null $componentClass = null, InlineRepeater|null $inlineRepeater = null)
Block constructor.
Block
setSource(string $source)
No description
array
getData(array $data, Block $block)
No description
array
getFormData()
Gets the form data. This is only called once and not per create.
This function is not aware of the context. If you need to know the current module you have to figure that out yourself by for example parsing the route.
Collection
toList()
No description
Collection
toShortList()
No description
string
makeName(string $name)
No description
Block
parse()
No description
array
getRules()
Checks both the blade file or helper class for validation rules. Returns in order the first one with data.
array
getRulesForTranslatedFields()
Checks both the blade file or helper class for validation rules. Returns in order the first one with data.
string
parseProperty(string $property, string $block, string $blockName, string|null $default = null)
Parse a string property directive in the form of @twillTypeProperty('value')
.
void
parseArrayProperty(string $property, string $block, string $blockName, callable $callback)
Parse an array property directive in the form of @twillTypeProperty([...])
and pass the result to a given callback.
mixed
parseMixedProperty(string $property, string $block, string $blockName, callable $callback)
Parse a mixed property directive in the form of @twillTypeProperty('value', [...])
and pass the result to a given callback.
bool
isNewFormat($block)
No description
string
getFileName()
No description
string
renderForm()
No description
getBlockView($blockViewMappings = [])
No description
void
setRenderData(RenderData $renderData)
No description
Block|null
block()
No description
string
renderView(array $blockViewMappings, array $data, bool $inEditor = false)
No description