Card can contain arbitrary information.
Card contains one main CardSection for adding content
but it can contains other CardSection using addSection method.
Each section can have it's own model, field to be displayed has
field value, field label, field value or as table.
Card also has an extra content section which is formatted
separately from Section content. Extra content may also have
model field display.
Multiple model can be used to display various content on each card section.
When using model or models, the first model that get set via setModel method
will have it's idField set as data-id HTML attribute for the card. Thus making
the ID available via javascript (new Jquery())->data('id')
| Methods |
protected
|
init(): void
Called when view becomes part of render tree. You can override it but avoid
placing any "heavy processing" here.
Called when view becomes part of render tree. You can override it but avoid
placing any "heavy processing" here.
Overrides
|
#
|
public
|
getSection(): CardSection
Get main section of this card.
Get main section of this card.
|
#
|
public
|
getImageContainer(): View
Get the image container of this card.
Get the image container of this card.
|
#
|
public
|
getExtraContainer(): View
Get the ExtraContainer of this card.
Get the ExtraContainer of this card.
|
#
|
public
|
getButtonContainer(): View
Get the button container of this card.
Get the button container of this card.
|
#
|
public
|
addContent(View $view): View
Add Content to card.
|
#
|
public
|
setModel(Model $entity, array<int, string>|null $fields = null): void
Associate this view with a model. Do not place any logic in this class, instead take it
to renderView().
Associate this view with a model. Do not place any logic in this class, instead take it
to renderView().
Do not try to create your own "Model" implementation, instead you must be looking for
your own "Persistence" implementation.
Overrides
|
#
|
public
|
addSection(
string $title = null,
Model $model = null,
array $fields = null,
bool $useTable = false,
bool $useLabel = false,
): View
Add a CardSection to this card.
Add a CardSection to this card.
|
#
|
public
|
addClickAction(UserAction $action, Button $button = null, array $args = [], string $confirm = null): $this
Execute Model user action via button in Card.
Execute Model user action via button in Card.
|
#
|
public
|
addExtraFields(Model $model, array $fields, string $glue = null): void
Set extra content using model field.
Set extra content using model field.
|
#
|
public
|
addDescription(string|View $description): View
Add Description to main card content.
Add Description to main card content.
|
#
|
public
|
addExtraContent(View $view): View
Add Extra content to the Card.
Extra content is added at the bottom of the card.
Add Extra content to the Card.
Extra content is added at the bottom of the card.
|
#
|
public
|
addImage(string|Image $img): View
Add image to card.
|
#
|
public
|
addButton(Button|array $seed): View
Add button to card.
|
#
|
| Properties |
public
|
|
$ui = 'card atk-card'
|
#
|
public
|
|
$defaultTemplate = 'card.html'
|
#
|
public
|
View|null
|
$imageContainer
A View that hold the image.
A View that hold the image.
|
#
|
public
|
string
|
$cardCss = 'segment'
Card box type.
|
#
|
public
|
string|Image|null
|
$image
A path to the image src or the image view.
A path to the image src or the image view.
|
#
|
public
|
CardSection|null
|
$section
The main card section of this card
The main card section of this card
|
#
|
public
|
string
|
$cardSection = CardSection::class
The CardSection default class name.
The CardSection default class name.
|
#
|
public
|
View|null
|
$extraContainer
The extra content view container for the card.
The extra content view container for the card.
|
#
|
public
|
string|View|null
|
$description
A description inside the Card content.
A description inside the Card content.
|
#
|
public
|
array|Button|null
|
$buttons
|
#
|
public
|
bool
|
$hasFluidButton = true
How buttons are display inside button container
How buttons are display inside button container
|
#
|
public
|
View|null
|
$buttonContainer
|
#
|
public
|
bool
|
$useTable = false
Display model field as table inside card holder content
Display model field as table inside card holder content
|
#
|
public
|
bool
|
$useLabel = false
Use Field label with value data.
Use Field label with value data.
|
#
|
public
|
string
|
$executor = ModalExecutor::class
Default executor class.
|
#
|