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_backup\hook;
18
 
19
/**
20
 * Hook used by copy_helper::process_formdata() to expand the list of required fields.
21
 * This should be used together with core_backup\hook\after_copy_form_definition.
22
 *
23
 * @package core_backup
24
 * @copyright 2024 Monash University (https://www.monash.edu)
25
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26
 */
27
#[\core\attribute\label('Able to add extra fields to the copy course.')]
28
#[\core\attribute\tags('backup')]
29
final class copy_helper_process_formdata {
30
 
31
    /** @var array List of extra fields to be added. */
32
    protected $extrafields = [];
33
 
34
    /**
35
     * Add an extra field.
36
     *
37
     * @param string $extrafield
38
     */
39
    public function add_extra_field(string $extrafield) {
40
        $this->extrafields[] = $extrafield;
41
    }
42
 
43
    /**
44
     * Get the extra fields.
45
     *
46
     * @return array
47
     */
48
    public function get_extrafields(): array {
49
        return $this->extrafields;
50
    }
51
}