You are here

function taxonomy_publisher_filter_form_views_exposed_form_alter in Taxonomy Tools 7

Same name and namespace in other branches
  1. 8 taxonomy_publisher_filter/taxonomy_publisher_filter.module \taxonomy_publisher_filter_form_views_exposed_form_alter()

Implements hook_form_FORM_ID_alter().

File

taxonomy_publisher_filter/taxonomy_publisher_filter.module, line 78

Code

function taxonomy_publisher_filter_form_views_exposed_form_alter(&$form, $form_state, $form_id) {
  global $user;
  $vocabularies = array_filter(variable_get('taxonomy_tools_publisher_config', array()));
  $t_fields = _taxonomy_publisher_filter_return_taxonomy_fields($form['#info']);
  $roles = array_values($user->roles);
  $roles = end($roles);
  if (count($t_fields)) {
    foreach ($t_fields as $field) {
      if ($form[$field]['#type'] == 'select' || $form[$field]['#type'] == 'radios' || $form[$field]['#type'] == 'checkboxes') {
        $settings = array(
          'role' => $roles,
          'vocabulary' => $field,
          'display_id' => $form['#id'],
        );
        _taxonomy_publisher_filter_filter_options($form[$field]['#options'], $field, $vocabularies, $settings);
      }
    }
  }
}