You are here

function globallink_build_filters in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.7 globallink.inc \globallink_build_filters()
  2. 7.6 globallink.inc \globallink_build_filters()

Builds filters.

Parameters

string $content_translation: The content translation type.

Return value

array Associative array of filters.

5 calls to globallink_build_filters()
globallink_build_filter_query in ./globallink.inc
Builds a filter query.
globallink_dashboard_node_filter_form in ./globallink_send_translations.inc
Builds form to filter GlobalLink nodes to send for translation on dashboard.
globallink_dashboard_node_filter_form_submit in ./globallink_send_translations.inc
Handles submission of filter form.
globallink_entity_dashboard_filter_form in globallink_entity/globallink_entity_send.inc
Builds form to filter entities to send for translation on dashboard.
globallink_entity_dashboard_filter_form_submit in globallink_entity/globallink_entity_send.inc
Handles submission of filter form.

File

./globallink.inc, line 114
Miscellaneous GlobalLink functions for node translations (non-entity).

Code

function globallink_build_filters($content_translation) {
  $filters = array();
  $filters['modified'] = array(
    'title' => 'Show',
    'field' => 'changed',
    'form-type' => 'radios',
    'options' => array(
      '  ' . t('Modified Content') . '    ',
      '  ' . t('Everything') . '  ',
    ),
  );
  if (module_exists('revisioning')) {
    $filters['status'] = array(
      'title' => t('Status'),
      'options' => array(
        'status-1' => t('Latest Published Revision'),
        'status-0' => t('Latest Modified Revision'),
        'promote-1' => t('Promoted'),
        'promote-0' => t('Not Promoted'),
        'sticky-1' => t('Sticky'),
        'sticky-0' => t('Not Sticky'),
      ),
      'form-type' => 'select',
    );
  }
  else {
    $filters['status'] = array(
      'title' => t('Status'),
      'options' => array(
        '[any]' => t('Any'),
        'status-1' => t('Published'),
        'status-0' => t('Not Published'),
        'promote-1' => t('Promoted'),
        'promote-0' => t('Not Promoted'),
        'sticky-1' => t('Sticky'),
        'sticky-0' => t('Not Sticky'),
      ),
      'form-type' => 'select',
    );
  }
  $languages = globallink_get_mapped_drupal_locales(FALSE);
  foreach ($languages as $key => $lang) {
    $lang_filter[$key] = $lang;
  }
  $filters['language_name'] = array(
    'title' => t('Source Language'),
    'field' => 'language',
    'options' => $lang_filter,
    'form-type' => 'select',
  );
  $filters['node_parent'] = array(
    'title' => t('Parent Node'),
    'field' => 'node_parent',
    'form-type' => 'checkbox',
  );
  $filters['target_language'] = array(
    'title' => t('Target Language'),
    'field' => 'language',
    'options' => $lang_filter,
    'form-type' => 'select',
  );
  $n_arr = array(
    '[any]' => t('Any'),
  );
  $t_arr = globallink_get_translatable_node_types_and_names($content_translation);
  $node_types_filter = $n_arr + $t_arr;
  $filters['type'] = array(
    'title' => t('Content Type'),
    'field' => 'type',
    'options' => $node_types_filter,
    'form-type' => 'select',
  );
  $filters['title'] = array(
    'title' => 'Title',
    'field' => 'title',
    'form-type' => 'textfield',
  );
  $filters['modified-after'] = array(
    'title' => 'Modified After',
    'field' => 'changed',
    'form-type' => 'textfield',
  );
  return $filters;
}