You are here

public function scald_views_handler_filter_actions::value_form in Scald: Media Management made easy 7

Same name and namespace in other branches
  1. 6 includes/scald_views_handler_filter_actions.inc \scald_views_handler_filter_actions::value_form()

Overrides value_form.

Provides checkboxes for the defined actions.

Overrides views_handler_filter::value_form

File

includes/scald_views_handler_filter_actions.inc, line 50
Provides a filter allowing to restrict the results by atoms actions.

Class

scald_views_handler_filter_actions
@file Provides a filter allowing to restrict the results by atoms actions.

Code

public function value_form(&$form, &$form_state) {
  $old_default = !is_array($this->options['value']);
  $defaults = $old_default ? array() : $this->options['value'];
  foreach (scald_actions() as $slug => $action) {
    $options[$slug] = $action['title'];
    if ($old_default) {
      $defaults[$slug] = $this->options['value'] & $action['bitmask'] ? $slug : '';
    }
  }

  // And now, we just need to add our select item with the values
  // we've prepared above.
  $form['value'] = array(
    '#title' => t('Actions'),
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => $defaults,
  );
}