-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_timeline_style_plugin.inc
67 lines (59 loc) · 1.67 KB
/
simple_timeline_style_plugin.inc
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
<?php
/**
* @file
* Contains the simple timeline style plugin.
* Created by JetBrains PhpStorm.
* User: alan
*/
/**
* Style plugin to render each item on a simple timeline.
*
* @ingroup views_style_plugins
*/
class simple_timeline_style_plugin extends views_plugin_style_list {
/**
* Modifies the options form inherited by this plugin.
*
* @param array $form
* The form being generated.
* @param array $form_state
* The state that the form has been posted in.
*/
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['type']['#type'] = 'hidden';
$form['row_class_special']['#title'] .= t(' (required on timelines)');
$form['row_class_special']['#disabled'] = TRUE;
}
/**
* Renders the data provided to this plugin.
*
* @return string
* The rendered html.
*/
public function render() {
backdrop_add_css(backdrop_get_path('module', 'simple_timeline') . '/simple_timeline.css', 'file');
// Set needed values for basic timeline proper functioning.
$this->options['wrapper_class'] .= ' simple-timeline';
return parent::render();
}
/**
* Validate whether this plugin is configured correctly.
*
* @return array
* The list of errors to be displayed.
*/
public function validate() {
$errors = array();
$row_plugin = get_class($this->row_plugin);
if (!in_array($row_plugin, array(
'views_plugin_row_node_view',
'panels_views_plugin_row_fields',
'simple_timeline_row_plugin',
))
) {
$errors[] = t('You have not selected an appropriate row plugin. your timeline will break');
}
return $errors;
}
}