MDL-55797 output: Support form method in chooser

Part of MDL-55071
This commit is contained in:
Frederic Massart
2016-09-23 10:55:17 +01:00
committed by Dan Poltawski
parent 6f0993ccbc
commit 7f8b7b2bb3
3 changed files with 14 additions and 2 deletions
+12
View File
@@ -45,6 +45,8 @@ class chooser implements renderable, templatable {
public $actionurl;
/** @var lang_string The instructions to display. */
public $instructions;
/** @var string The form method. */
public $method = 'post';
/** @var string The name of the parameter for the items value. */
public $paramname;
/** @var array The list of hidden parameters. See {@link self::add_param}. */
@@ -96,6 +98,15 @@ class chooser implements renderable, templatable {
$this->instructions = $value;
}
/**
* Set the form method.
*
* @param string $value The method.
*/
public function set_method($value) {
$this->method = $value;
}
/**
* Export for template.
*
@@ -107,6 +118,7 @@ class chooser implements renderable, templatable {
$data->actionurl = $this->actionurl->out(false);
$data->instructions = (string) $this->instructions;
$data->method = $this->method;
$data->paramname = $this->paramname;
$data->params = $this->params;
$data->sesskey = sesskey();
+1 -1
View File
@@ -24,7 +24,7 @@
<div class="chooserdialoguebody">
<div class="choosercontainer">
<div id="chooseform">
<form action="{{actionurl}}" id="chooserform" method="post">
<form action="{{actionurl}}" id="chooserform" method="{{method}}">
<div id="typeformdiv">
{{#params}}
<input type="hidden" id="{{id}}" name="{{name}}" value="{{value}}">
+1 -1
View File
@@ -24,7 +24,7 @@
<div class="chooserdialoguebody">
<div class="choosercontainer">
<div id="chooseform">
<form action="{{actionurl}}" id="chooserform" method="post">
<form action="{{actionurl}}" id="chooserform" method="{{method}}">
<div id="typeformdiv">
{{#params}}
<input type="hidden" id="{{id}}" name="{{name}}" value="{{value}}">