-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft.rc_notes.php
More file actions
101 lines (75 loc) · 2.7 KB
/
ft.rc_notes.php
File metadata and controls
101 lines (75 loc) · 2.7 KB
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
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Rc_notes_ft extends EE_Fieldtype {
var $info = array(
'name' => 'Red Carrot Notes',
'version' => '1.1'
);
// --------------------------------------------------------------------
var $has_array_data = TRUE;
function install()
{
return array(
'title' => '',
'description' => '',
'colour' => '#E11842',
'padding' => '25px'
);
}
function display_global_settings()
{
$val = array_merge($this->settings, $_POST);
$form = form_label('Box Padding', 'padding').NBS.form_input('padding', $val['padding']).NBS.NBS.NBS.' ';
return $form;
}
function save_global_settings()
{
return array_merge($this->settings, $_POST);
}
function save_settings($data)
{
return array(
'title' => $this->EE->input->post('title'),
'description' => $this->EE->input->post('description'),
'colour' => $this->EE->input->post('colour')
);
}
function display_settings($data)
{
$title = isset($data['title']) ? $data['title'] : $this->settings['title'];
$description = isset($data['description']) ? $data['description'] : $this->settings['description'];
$colour = isset($data['colour']) ? $data['colour'] : $this->settings['colour'];
$this->EE->table->add_row(
lang('Title', 'title'),
form_input('title', $title)
);
$this->EE->table->add_row(
lang('Description', 'description'),
form_input('description', $description)
);
$this->EE->table->add_row(
lang('Colour', 'colour'),
form_input('colour', $colour)
);
}
function display_field($data)
{
$data_points = array('title', 'description', 'colour', 'padding');
if ($data)
{
list($title, $description, $colour, $padding) = explode('|', $data);
}
else
{
foreach($data_points as $key)
{
$$key = $this->settings[$key];
}
}
$prototype = '<div class="rc-note" style="background: '.$colour.'; color: #fff; padding: '. $padding .'; margin-top: 50px; border-bottom: #2d4a5d 2px solid;">';
$prototype .= '<h3 style="color: #fff; margin: 0;">'. $title .'</h3>';
$prototype .= '<p style="color: #fff;">'.$description.'</p>';
$prototype .= '</div>';
$prototype .= '<style type="text/css">.publish_rc_notes .hide_field, .publish_rc_notes .instruction_text { display: none; } .publish_rc_notes fieldset.holder { margin: 0 !important; padding: 0; } .publish_rc_notes p { line-height: 20px; font-size: 13px; } .publish_rc_notes h3 { font-size: 22px !important; } .publish_rc_notes { border: none; } .publish_rc_notes:first-of-type .rc-note, #hold_field_120 .rc-note { margin-top: 0px !important; }</style>';
return $prototype;
}
}