You are here

function scald_views_handler_filter_actions::value_form in Scald: Media Management made easy 6

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

Overrides value_form: provides checkboxes for the defined actions.

File

includes/scald_views_handler_filter_actions.inc, line 23
Provides a Views filter handler allowing to restrict the results to atoms the user can interact with.

Class

scald_views_handler_filter_actions
@file Provides a Views filter handler allowing to restrict the results to atoms the user can interact with.

Code

function value_form(&$form, &$form_state) {

  // First, get the config
  $config = variable_get('scald_config', 0);

  // And prepare our default, the value needs to be reformated for FAPI
  // to deal with it correctly.
  $defaults = array();
  foreach ($config->actions as $slug => $action) {
    $options[$slug] = $action['title'];
    $defaults[$slug] = $this->options['value'] & $action['mask'] ? $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,
  );
}