You are here

function workflow_views_handler_filter_sid::get_value_options in Workflow 7.2

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 workflow_views/includes/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

1 call to workflow_views_handler_filter_sid::get_value_options()
workflow_views_handler_filter_sid::admin_summary in workflow_views/handlers/workflow_views_handler_filter_sid.inc
Display the filter on the administrative summary.

File

workflow_views/handlers/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)) {
    return;
  }
  if (!isset($this->value_options)) {

    // Show the possible State options.
    $this->value_options = array();
    $this->value_title = t('Workflow state');
    $all = (bool) $this->options['expose']['workflow_include_all'];
    $wid = isset($this->options['expose']['workflow_reduce_wid']) ? $this->options['expose']['workflow_reduce_wid'] : 0;
    $states = array();

    // Count the workflows to determine grouping.
    // Even if $wid is not set, we may only have 1 workflow.
    $grouped = FALSE;
    $workflows = workflow_load_multiple($wid ? array(
      $wid,
    ) : FALSE);
    $count = count($workflows);
    if ($count > 1) {
      $states += array(
        '' => t('No state'),
      );
      $states += array(
        'ANY' => t('A state'),
      );
      $grouped = TRUE;
    }
    $states += workflow_get_workflow_state_names($wid, $grouped, $all);
    $this->value_options = $states;
  }
  return $this->value_options;
}