You are here

function workflow_views_handler_filter_sid::get_value_options in Workflow 7

Same name and namespace in other branches
  1. 6.2 workflow_views/includes/workflow_views_handler_filter_sid.inc \workflow_views_handler_filter_sid::get_value_options()
  2. 6 workflow_views/includes/workflow_views_handler_filter_sid.inc \workflow_views_handler_filter_sid::get_value_options()
  3. 7.2 workflow_views/handlers/workflow_views_handler_filter_sid.inc \workflow_views_handler_filter_sid::get_value_options()

Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

This can use a guard to be used to reduce database hits as much as possible.

Return value

Return the stored values in $this->value_options if someone expects it.

Overrides views_handler_filter_in_operator::get_value_options

File

workflow_views/includes/workflow_views_handler_filter_sid.inc, line 13
Provide views filter handler for workflow.module.

Class

workflow_views_handler_filter_sid
Filter by state.

Code

function get_value_options() {
  if (!isset($this->value_options)) {
    $this->value_options = array();
    $this->value_title = t('Workflow state');
    $states = array();
    $workflows = Workflow::getWorkflows();
    $count = count($workflows);
    if ($count > 1) {
      $states += array(
        '' => t('No state'),
      );
    }
    foreach ($workflows as $workflow) {

      // Only show the workflow name if more then 1 workflows exist.
      $states += $workflow
        ->getOptions($grouped = $count != 1);
    }
    $this->value_options = $states;
  }
}