extends |
View |
|---|
This class add modal dialog to a page.
Modal are added to the layout but their content is hidden by default. $modal->jsShow() is the triggered needed to actually display the modal.
Modal can be use as a regular view, simply by adding other view to it. Message::addTo($modal, ['title' => 'Welcome to Agile Toolkit'])->text('Your text here');
Modal can add content dynamically via CallbackLater. $modal->set(function (View $p) { Form::addTo($p); });
Modal can use Fomantic-UI predefine method onApprove or onDeny by passing a jsAction to Modal::addDenyAction or Modal::addApproveAction method. It will not close until the jsAction return true. $modal->addDenyAction('No', new JsExpression('function () { window.alert('Cannot do that.'); return false; }')); $modal->addApproveAction('Yes', new JsExpression('function () { window.alert('You are good to go!'); }'));
You may also prevent modal from closing via the esc or dimmed area click using $modal->notClosable().
| Methods | ||
|---|---|---|
public
|
set(Closure(View): void $fx = null)
|
# |
public
|
enableCallback(): void
|
# |
public
|
addContentCss(string|array $class): void
|
# |
public
|
jsShow(array $args = []): JsChain
|
# |
public
|
jsHide(): JsChain
|
# |
public
|
setOption(string $option, mixed $value): $this
|
# |
public
|
addScrolling(): $this
|
# |
public
|
addDenyAction(string $label, JsExpressionable $jsAction): $this
|
# |
public
|
addApproveAction(string $label, JsExpressionable $jsAction): $this
|
# |
public
|
addButtonAction(View $button): $this
|
# |
public
|
notClosable(): $this
|
# |
protected
|
renderView(): void
|
# |
| Methods inherited from Atk4\Ui\AbstractView |
|---|
getOwner() |
| Methods used from Atk4\Core\AppScopeTrait |
|---|
assertInstanceOfApp(), issetApp(), getApp(), setApp() |
| Methods used from Atk4\Core\ContainerTrait |
|---|
_uniqueElementName(), _addContainer(), removeElement(), _shorten(), getElement(), hasElement() |
| Methods used from Atk4\Core\InitializerTrait |
|---|
isInitialized(), assertIsInitialized(), invokeInit() |
| Methods used from Atk4\Core\StaticAddToTrait |
|---|
_addToAdd(), addTo(), addToWithCl(), addToWithClUnsafe() |
| Methods used from Atk4\Core\TrackableTrait |
|---|
issetOwner(), setOwner(), unsetOwner(), getDesiredName(), destroy() |
| Properties | |||
|---|---|---|---|
public
|
|
$ui = 'modal'
|
# |
public
|
|
$defaultTemplate = 'modal.html'
|
# |
public
|
string|null
|
$title
|
# |
public
|
string
|
$loadingLabel = 'Loading...'
|
# |
public
|
string
|
$headerCss = 'header'
|
# |
public
|
(Closure(View): void)|null
|
$fx
|
# |
public
|
CallbackLater|null
|
$cb
|
# |
public
|
View|null
|
$cbView
|
# |
public
|
array
|
$args = []
|
# |
public
|
array
|
$options = []
|
# |
public
|
string
|
$type = 'json'
|
# |
public
|
array
|
$contentCss = ['img', 'content', 'atk-dialog-content']
|
# |
public
|
bool
|
$showActions = false
|
# |
| Properties inherited from Atk4\Ui\View |
|---|
$_jsActions, $model, $region, $class, $style, $attr, $template, $content, $element, $executorFactory, $stickyArgs |
| Properties inherited from Atk4\Ui\AbstractView |
|---|
$_addLater, $_rendered, $elements |
| Properties used from Atk4\Core\AppScopeTrait |
|---|
$_app, $maxNameLength, $uniqueNameHashes |
| Properties used from Atk4\Core\ContainerTrait |
|---|
$_elementNameCounts |
| Properties used from Atk4\Core\InitializerTrait |
|---|
$_initialized |
| Properties used from Atk4\Core\NameTrait |
|---|
$name |
| Properties used from Atk4\Core\TrackableTrait |
|---|
$_owner, $shortName |