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