Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
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/>.
16
 
17
namespace core\router\parameters;
18
 
19
use core\param;
20
use core\router\schema\referenced_object;
21
use core\router\schema\example;
22
 
23
/**
24
 * Routing parameter for validation.
25
 *
26
 * @package    core
27
 * @copyright  2023 Andrew Lyons <andrew@nicols.co.uk>
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 */
30
class path_themename extends \core\router\schema\parameters\path_parameter implements referenced_object {
31
    /**
32
     * Create a new path_themename parameter.
33
     *
34
     * @param string $name The name of the parameter to use for the theme name
35
     * @param mixed ...$args Additional arguments
36
     */
37
    public function __construct(
38
        string $name = 'themename',
39
        ...$args,
40
    ) {
41
        $args['name'] = $name;
42
 
43
        $args['type'] = param::ALPHANUMEXT;
44
        $args['description'] = 'The name of a Moodle theme.';
45
        $args['examples'] = [
46
            new example(
47
                name: 'The Boost theme',
48
                value: 'boost',
49
            ),
50
            new example(
51
                name: 'The Classic theme',
52
                value: 'classic',
53
            ),
54
        ];
55
 
56
        parent::__construct(...$args);
57
    }
58
}