1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
<?php
namespace Courseware\BlockTypes;
use Opis\JsonSchema\Validator;
/**
* This class represents the content of a Courseware headline block.
*
* @author Ron Lucke <lucke@elan-ev.de>
* @license GPL2 or any later version
*
* @since Stud.IP 5.0
*/
class Headline extends BlockType
{
public static function getType(): string
{
return 'headline';
}
public static function getTitle(): string
{
return _('Blickfang');
}
public static function getDescription(): string
{
return _('Erzeugt einen typografisch ansprechenden Text.');
}
public function initialPayload(): array
{
return [
'title' => 'Courseware',
'subtitle' => '',
'second_subtitle' => '',
'style' => 'bigicon_before',
'height' => 'half',
'background_color' => '#28497c',
'gradient' => '',
'background_image_id' => '',
'background_type' => 'color',
'text_color' => '#ffffff',
'text_background_color' => '#000000',
'icon' => 'learnmodule',
'icon_color' => 'white',
];
}
public static function getJsonSchema(): string
{
$schemaFile = __DIR__.'/Headline.json';
return file_get_contents($schemaFile);
}
/**
* get all files related to this block.
*
* @return \FileRef[] list of file references related to this block
*/
public function getFiles(): array
{
$payload = $this->getPayload();
$files = [];
if ($payload['background_image_id'] && $fileRef = \FileRef::find($payload['background_image_id'])) {
$files[] = $fileRef;
}
return $files;
}
public function copyPayload(string $rangeId = ''): array
{
$payload = $this->getPayload();
if ('' != $payload['background_image_id']) {
$payload['background_image_id'] = $this->copyFileById($payload['background_image_id'], $rangeId);
$payload['background_image'] = '';
}
return $payload;
}
public function validatePayload($payload): bool
{
unset($payload->background_image);
return parent::validatePayload($payload);
}
public static function getCategories(): array
{
return ['layout'];
}
public static function getContentTypes(): array
{
return ['text'];
}
public static function getFileTypes(): array
{
return [];
}
public static function getTags(): array
{
return [
_('Gestaltung'), _('Überschrift'), _('Text'), _('Dekoration'), _('Trenner'),
_('Design'), _('Titel'), _('Illustration'), _('Thema'), _('Auflockerung'),
_('Strukturierung'), _('Icon'), _('Farbe'), _('Layout'), _('Banner'),
_('highlighten'), _('Markierung'), _('hervorheben')
];
}
}
|