36 lines
822 B
PHP
36 lines
822 B
PHP
<?php
|
|
namespace nur\v\plugins;
|
|
|
|
use nur\v\BasePlugin;
|
|
use nur\v\js;
|
|
|
|
/**
|
|
* Class navigatePlugin: spécifier ce qu'il faut faire quand on appuie sur
|
|
* Entrée dans un élément de formulaire
|
|
*/
|
|
class navigatePlugin extends BasePlugin {
|
|
const ON_ENTER_SUBMIT = "submit";
|
|
const ON_ENTER_NEXT = "next";
|
|
const ON_ENTER_DISABLE = "disable";
|
|
|
|
const HAVE_JQUERY = true;
|
|
const JS = [
|
|
#"jquery" => "nur-base/jquery/jquery.js",
|
|
"nur-base/navigate/main.min.js",
|
|
];
|
|
|
|
function __construct(?string $on_enter=null) {
|
|
if ($on_enter === null) $on_enter = self::ON_ENTER_SUBMIT;
|
|
$this->on_enter = $on_enter;
|
|
}
|
|
|
|
/** @var string action à effectuer lors de l'appui de la touche Entrée */
|
|
private $on_enter;
|
|
|
|
function printJquery(): void {
|
|
?>
|
|
$.navigate(<?=js::qv($this->on_enter)?>);
|
|
<?php
|
|
}
|
|
}
|