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_course\hook;
18
 
19
use cm_info;
20
use section_info;
21
use core\hook\described_hook;
22
use core_course\output\activitychooserbutton;
23
 
24
/**
25
 * Hook before activity chooser button export.
26
 *
27
 * @package    core_course
28
 * @copyright  2024 Mikel Martín <mikel@moodle.com>
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
31
class before_activitychooserbutton_exported implements described_hook {
32
    /**
33
     * Constructor.
34
     *
35
     * @param activitychooserbutton $activitychooserbutton the activity chooser button output
36
     * @param section_info $section the course section
37
     * @param cm_info|null $cm the course module
38
     */
39
    public function __construct(
40
        /** @var activitychooserbutton the activity chooser button output */
41
        protected activitychooserbutton $activitychooserbutton,
42
        /** @var section_info the course section */
43
        protected section_info $section,
44
        /** @var cm_info|null the course module */
45
        protected ?cm_info $cm = null,
46
    ) {
47
    }
48
 
49
    /**
50
     * Describes the hook purpose.
51
     *
52
     * @return string
53
     */
54
    public static function get_hook_description(): string {
55
        return 'This hook is triggered when a activity chooser button is exported.';
56
    }
57
 
58
    /**
59
     * List of tags that describe this hook.
60
     *
61
     * @return string[]
62
     */
63
    public static function get_hook_tags(): array {
64
        return ['course'];
65
    }
66
 
67
    /**
68
     * Get activitychooserbutton output instance.
69
     *
70
     * @return activitychooserbutton
71
     */
72
    public function get_activitychooserbutton(): activitychooserbutton {
73
        return $this->activitychooserbutton;
74
    }
75
 
76
    /**
77
     * Get course section instance.
78
     *
79
     * @return section_info
80
     */
81
    public function get_section(): section_info {
82
        return $this->section;
83
    }
84
 
85
    /**
86
     * Get course module instance.
87
     *
88
     * @return cm_info|null
89
     */
90
    public function get_cm(): ?cm_info {
91
        return $this->cm;
92
    }
93
}