Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 14... Línea 14...
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea 17...
17
namespace core\output;
17
namespace core\output;
18
 
-
 
19
use moodle_exception;
-
 
20
use renderable;
-
 
Línea 21... Línea 18...
21
use renderer_base;
18
 
22
use templatable;
19
use core\exception\moodle_exception;
23
 
20
 
24
/**
21
/**
25
 * Renderable class for the comboboxsearch.
22
 * Renderable class for the comboboxsearch.
26
 *
23
 *
27
 * @package    core_output
24
 * @package    core
28
 * @copyright  2022 Mathew May <Mathew.solutions>
25
 * @copyright  2022 Mathew May <Mathew.solutions>
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
30
 */
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
class comboboxsearch implements renderable, templatable {
27
 */
32
 
28
class comboboxsearch implements renderable, named_templatable {
33
    /** @var bool $renderlater Should the dropdown render straightaway? We sometimes need to output the component without all of the
29
    /** @var bool $renderlater Should the dropdown render straightaway? We sometimes need to output the component without all of the
Línea 51... Línea 47...
51
    protected $dropdownclasses;
47
    protected $dropdownclasses;
Línea 52... Línea 48...
52
 
48
 
53
    /** @var null|string $buttonheader If the button item in the tertiary nav needs an extra top header for context. */
49
    /** @var null|string $buttonheader If the button item in the tertiary nav needs an extra top header for context. */
Línea 54... Línea 50...
54
    protected $buttonheader;
50
    protected $buttonheader;
55
 
51
 
Línea 56... Línea 52...
56
    /** @var boolean $usesbutton Whether to provide a A11y button. */
52
    /** @var bool $usesbutton Whether to provide a A11y button. */
57
    protected $usesbutton;
53
    protected $usesbutton;
Línea 97... Línea 93...
97
        // Ensure implementors cant request to render the content now and not provide us any to show.
93
        // Ensure implementors cant request to render the content now and not provide us any to show.
98
        if (!$renderlater && empty($dropdowncontent)) {
94
        if (!$renderlater && empty($dropdowncontent)) {
99
            throw new moodle_exception(
95
            throw new moodle_exception(
100
                'incorrectdropdownvars',
96
                'incorrectdropdownvars',
101
                'core',
97
                'core',
-
 
98
                '',
102
                '', null,
99
                null,
103
                'Dropdown content must be set to render later.'
100
                'Dropdown content must be set to render later.'
104
            );
101
            );
105
        }
102
        }
Línea 106... Línea 103...
106
 
103
 
107
        if ($usebutton && !$label) {
104
        if ($usebutton && !$label) {
108
            debugging(
105
            debugging(
109
                    'You have requested to use the button but have not provided a label for the combobox.',
106
                'You have requested to use the button but have not provided a label for the combobox.',
110
                    DEBUG_DEVELOPER
107
                DEBUG_DEVELOPER
111
            );
108
            );
Línea 112... Línea 109...
112
        }
109
        }
113
 
110
 
Línea 138... Línea 135...
138
     * @return array
135
     * @return array
139
     */
136
     */
140
    public function export_for_template(renderer_base $output): array {
137
    public function export_for_template(renderer_base $output): array {
141
        return [
138
        return [
142
            'renderlater' => $this->renderlater,
139
            'renderlater' => $this->renderlater,
143
            'buttoncontent' => $this->buttoncontent ,
140
            'buttoncontent' => $this->buttoncontent,
144
            'dropdowncontent' => $this->dropdowncontent,
141
            'dropdowncontent' => $this->dropdowncontent,
145
            'parentclasses' => $this->parentclasses,
142
            'parentclasses' => $this->parentclasses,
146
            'buttonclasses' => $this->buttonclasses,
143
            'buttonclasses' => $this->buttonclasses,
147
            'dropdownclasses' => $this->dropdownclasses,
144
            'dropdownclasses' => $this->dropdownclasses,
148
            'buttonheader' => $this->buttonheader,
145
            'buttonheader' => $this->buttonheader,
Línea 155... Línea 152...
155
    }
152
    }
Línea 156... Línea 153...
156
 
153
 
157
    /**
154
    /**
158
     * Returns the standard template for the dropdown.
155
     * Returns the standard template for the dropdown.
-
 
156
     *
159
     *
157
     * @deprecated since Moodle 4.5. {@see named_templatable::get_template_name() instead}
160
     * @return string
158
     * @return string
161
     */
159
     */
-
 
160
    public function get_template(): string {
-
 
161
        debugging('get_template is deprecated. Please use get_template_name instead');
-
 
162
 
-
 
163
        return 'core/comboboxsearch';
-
 
164
    }
-
 
165
 
162
    public function get_template(): string {
166
    public function get_template_name(renderer_base $renderer): string {
163
        return 'core/comboboxsearch';
167
        return 'core/comboboxsearch';
164
    }
168
    }