Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 59... Línea 59...
59
     * Constructor.
59
     * Constructor.
60
     *
60
     *
61
     * @param int $id
61
     * @param int $id
62
     * @param \stdClass|null $record
62
     * @param \stdClass|null $record
63
     */
63
     */
64
    public function __construct(int $id = 0, \stdClass $record = null) {
64
    public function __construct(int $id = 0, ?\stdClass $record = null) {
65
        $this->field = new field($id, $record);
65
        $this->field = new field($id, $record);
66
    }
66
    }
Línea 67... Línea 67...
67
 
67
 
68
    /**
68
    /**
Línea 79... Línea 79...
79
     * @param category_controller|null $category
79
     * @param category_controller|null $category
80
     * @return field_controller will return the instance of the class from the customfield element plugin
80
     * @return field_controller will return the instance of the class from the customfield element plugin
81
     * @throws \coding_exception
81
     * @throws \coding_exception
82
     * @throws \moodle_exception
82
     * @throws \moodle_exception
83
     */
83
     */
84
    public static function create(int $id, \stdClass $record = null, category_controller $category = null): field_controller {
84
    public static function create(int $id, ?\stdClass $record = null, ?category_controller $category = null): field_controller {
85
        global $DB;
85
        global $DB;
86
        if ($id && $record) {
86
        if ($id && $record) {
87
            // This warning really should be in persistent as well.
87
            // This warning really should be in persistent as well.
88
            debugging('Too many parameters, either id need to be specified or a record, but not both.',
88
            debugging('Too many parameters, either id need to be specified or a record, but not both.',
89
                DEBUG_DEVELOPER);
89
                DEBUG_DEVELOPER);
Línea 253... Línea 253...
253
    abstract public function config_form_definition(\MoodleQuickForm $mform);
253
    abstract public function config_form_definition(\MoodleQuickForm $mform);
Línea 254... Línea 254...
254
 
254
 
255
    /**
255
    /**
256
     * Returns the field name formatted according to configuration context.
256
     * Returns the field name formatted according to configuration context.
-
 
257
     *
257
     *
258
     * @param bool $escape
258
     * @return string
259
     * @return string
259
     */
260
     */
260
    public function get_formatted_name(): string {
261
    public function get_formatted_name(bool $escape = true): string {
261
        $context = $this->get_handler()->get_configuration_context();
262
        $context = $this->get_handler()->get_configuration_context();
-
 
263
        return format_string($this->get('name'), true, [
-
 
264
            'context' => $context,
-
 
265
            'escape' => $escape,
262
        return format_string($this->get('name'), true, ['context' => $context]);
266
        ]);
Línea 263... Línea 267...
263
    }
267
    }
264
 
268
 
265
    /**
269
    /**