Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
/**
18
 * An attribute changes how a field definition is designated or behaves.
19
 *
20
 * @package    block_dash
21
 * @copyright  2019 bdecent gmbh <https://bdecent.de>
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
namespace block_dash\local\dash_framework\structure;
26
 
27
use block_dash\local\dash_framework\structure\field_interface;
28
/**
29
 * An attribute changes how a field definition is designated or behaves.
30
 *
31
 * @package block_dash
32
 */
33
interface field_attribute_interface {
34
 
35
    /**
36
     * Set the field definition this attribute is attached to.
37
     *
38
     * @param field_interface $fielddefinition
39
     */
40
    public function set_field(field_interface $fielddefinition);
41
 
42
    /**
43
     * Get a single field.
44
     *
45
     * @return field_interface
46
     */
47
    public function get_field();
48
 
49
    /**
50
     * After records are relieved from database each field has a chance to transform the data.
51
     * Example: Convert unix timestamp into a human readable date format
52
     *
53
     * @param mixed $data Raw data associated with this field definition.
54
     * @param \stdClass $record Full record from database.
55
     * @return mixed
56
     */
57
    public function transform_data($data, \stdClass $record);
58
 
59
    /**
60
     * Get a single option.
61
     *
62
     * @param string $name
63
     * @return mixed|null
64
     */
65
    public function get_option($name);
66
 
67
    /**
68
     * Set option on field.
69
     *
70
     * @param string $name
71
     * @param string $value
72
     */
73
    public function set_option($name, $value);
74
 
75
    /**
76
     * Set options on field.
77
     *
78
     * @param array $options
79
     */
80
    public function set_options($options);
81
 
82
    /**
83
     * Get all options for this field.
84
     *
85
     * @return array
86
     */
87
    public function get_options();
88
 
89
    /**
90
     * Add option.
91
     *
92
     * @param string $name
93
     * @param string $value
94
     */
95
    public function add_option($name, $value);
96
}