Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 22... Línea 22...
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
23
 */
Línea 24... Línea 24...
24
 
24
 
Línea 25... Línea 25...
25
namespace core\output;
25
namespace core\output;
26
 
26
 
27
use coding_exception;
-
 
28
use context;
-
 
29
use pix_icon;
-
 
30
use renderer_base;
27
use core\exception\coding_exception;
31
use renderable;
-
 
Línea 32... Línea 28...
32
use stdClass;
28
use core\context;
33
use templatable;
29
use stdClass;
34
 
30
 
35
/**
31
/**
36
 * The chooser_item renderable class.
32
 * The chooser_item renderable class.
37
 *
33
 *
38
 * @package    core
34
 * @package    core
39
 * @copyright  2016 Frédéric Massart - FMCorz.net
35
 * @copyright  2016 Frédéric Massart - FMCorz.net
40
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
41
 */
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
42
class chooser_item implements renderable, templatable {
37
 */
43
 
38
class chooser_item implements renderable, templatable {
44
    /** @var string An identifier for the item. */
39
    /** @var string An identifier for the item. */
45
    public $id;
40
    public $id;
Línea 55... Línea 50...
55
    public $context;
50
    public $context;
Línea 56... Línea 51...
56
 
51
 
57
    /**
52
    /**
58
     * Constructor.
53
     * Constructor.
59
     */
54
     */
60
    public function __construct($id, $label, $value, pix_icon $icon, $description = null, context $context = null) {
55
    public function __construct($id, $label, $value, pix_icon $icon, $description = null, ?context $context = null) {
61
        $this->id = $id;
56
        $this->id = $id;
62
        $this->label = $label;
57
        $this->label = $label;
63
        $this->value = $value;
58
        $this->value = $value;
64
        $this->icon = $icon;
59
        $this->icon = $icon;
Línea 91... Línea 86...
91
        $options->newlines = false;
86
        $options->newlines = false;
92
        $options->overflowdiv = false;
87
        $options->overflowdiv = false;
Línea 93... Línea 88...
93
 
88
 
94
        $data->description = '';
89
        $data->description = '';
95
        if (!empty($this->description)) {
90
        if (!empty($this->description)) {
-
 
91
            [$data->description] = \core_external\util::format_text(
-
 
92
                (string) $this->description,
96
            list($data->description) = \core_external\util::format_text((string) $this->description, FORMAT_MARKDOWN,
93
                FORMAT_MARKDOWN,
-
 
94
                $this->context->id,
-
 
95
                null,
-
 
96
                null,
-
 
97
                null,
-
 
98
                $options
97
                $this->context->id, null, null, null, $options);
99
            );
Línea 98... Línea 100...
98
        }
100
        }
99
 
101
 
100
        return $data;
-
 
101
    }
102
        return $data;