for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* ModalTrait.php - Show and hide dialogs.
*
* @package jaxon-core
* @author Thierry Feuzeu <[email protected]>
* @copyright 2024 Thierry Feuzeu <[email protected]>
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link https://github.com/jaxon-php/jaxon-core
*/
namespace Jaxon\App\Dialog\Library;
trait ModalTrait
{
* Show a modal dialog.
* @param string $sTitle The title of the dialog
* @param string $sContent The content of the dialog
* @param array $aButtons The buttons of the dialog
* @param array $aOptions The options of the dialog
* Each button is an array with the following entries:
* - title: the text to be printed in the button
* - class: the CSS class of the button
* - click: the javascript function to be called when the button is clicked
* If the click value is set to "close", then the button closes the dialog.
* The content of the $aOptions depends on the javascript library in use.
* Check their specific documentation for more information.
* @return array
public function show(string $sTitle, string $sContent, array $aButtons, array $aOptions = []): array
return [
'dialog' => [
'title' => $sTitle,
'content' => $sContent,
'buttons' => $aButtons,
'options' => $aOptions,
],
];
}
* Hide the modal dialog.
public function hide(): array
return [];