public function webform_workflow_views_handler_filter_state::value_form in Webform Workflow 7
Overrides parent::value_form().
Overrides views_handler_filter_in_operator::value_form
File
- includes/
views/ handlers/ webform_workflow_views_handler_filter_state.inc, line 90 - Views filter handler for webform submission workflow states.
Class
- webform_workflow_views_handler_filter_state
- @file Views filter handler for webform submission workflow states.
Code
public function value_form(&$form, &$form_state) {
parent::value_form($form, $form_state);
$colors = array();
// For every state ID (wsid) in the available options, load the state and
// find out its color.
$options = $form['value']['#options'];
unset($options['[EMPTY]']);
$wsids = array_keys($options);
if ($wsids) {
foreach (entity_load('webform_workflow_state', $wsids) as $state) {
if ($state->color) {
$colors['state-' . $state->wsid] = $state->color;
}
}
}
// Apply the colors to the form.
if ($colors) {
$form['value']['#attributes']['class'] = array(
'webform-workflow-state-select',
);
$form['value']['#attached']['js'] = array(
drupal_get_path('module', 'webform_workflow') . '/includes/webform_workflow.js',
array(
'data' => array(
'webformWorkflow' => array(
'stateColors' => $colors,
),
),
'type' => 'setting',
),
);
}
}