class views_plugin_style_watchdog_table in Views Watchdog 6
Same name and namespace in other branches
- 6.3 views/plugins/views_plugin_style_watchdog_table.inc \views_plugin_style_watchdog_table
- 6.2 views/plugins/views_plugin_style_watchdog_table.inc \views_plugin_style_watchdog_table
- 7.3 views/plugins/views_plugin_style_watchdog_table.inc \views_plugin_style_watchdog_table
Hierarchy
- class \views_plugin_style_watchdog_table extends \views_plugin_style_table
Expanded class hierarchy of views_plugin_style_watchdog_table
1 string reference to 'views_plugin_style_watchdog_table'
- views_watchdog_views_plugins in views/
views_watchdog.views.inc - Implementation of hook_views_plugins
File
- views/
plugins/ views_plugin_style_watchdog_table.inc, line 12 - Views callbacks for the "Views watchdog" module.
View source
class views_plugin_style_watchdog_table extends views_plugin_style_table {
function option_definition() {
$options = parent::option_definition();
$options['watchdog_table_severity'] = array(
'default' => TRUE,
);
foreach (views_watchdog_get_severity() as $key => $value) {
$options['watchdog_table_severity_' . $value['arg']] = array(
'default' => $value['class'],
'translatable' => FALSE,
);
}
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['watchdog_table_severity'] = array(
'#type' => 'checkbox',
'#title' => t('Add CSS classes to each table row based on severity level.'),
'#default_value' => !empty($this->options['watchdog_table_severity']),
);
foreach (views_watchdog_get_severity() as $key => $value) {
$form['watchdog_table_severity_' . $value['arg']] = array(
'#type' => 'textfield',
'#title' => $value['title'],
'#description' => $value['text'],
'#default_value' => $this->options['watchdog_table_severity_' . $value['arg']],
'#process' => array(
'views_process_dependency',
),
'#dependency' => array(
'edit-style-options-watchdog-table-severity' => array(
1,
),
),
);
}
}
function options_validate(&$form, &$form_state) {
parent::options_validate($form, $form_state);
foreach (views_watchdog_get_severity() as $key => $value) {
$class = trim($form_state['values']['style_options']['watchdog_table_severity_' . $value['arg']]);
$field = $form['watchdog_table_severity_' . $value['arg']];
if (preg_match('/[^a-zA-Z0-9-]/', $class)) {
form_error($field, t('CSS class name must be alphanumeric or dashes only.'));
}
}
}
}