function lingotek_config_build_filters in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.bulk_grid.inc \lingotek_config_build_filters()
1 call to lingotek_config_build_filters()
File
- ./
lingotek.bulk_grid.inc, line 1091
Code
function lingotek_config_build_filters($form_state) {
$languages = language_list();
$search_languages = array(
'all' => t('All Languages'),
);
foreach ($languages as $code => $language) {
$search_languages[$code] = t($language->name) . ' (' . $language->lingotek_locale . ')';
}
$modules = array_map('ucfirst', module_list(FALSE, FALSE, TRUE));
$filters = array(
'lid' => array(
'#type' => 'textfield',
'#default_value' => isset($_SESSION['grid_filters']['lid']) ? $_SESSION['grid_filters']['lid'] : '',
'#title' => t('Config Entity ID is'),
'#size' => 8,
),
'document_id' => array(
'#type' => 'textfield',
'#default_value' => isset($_SESSION['grid_filters']['document_id']) ? $_SESSION['grid_filters']['document_id'] : '',
'#title' => t('Doc ID is'),
'#size' => 10,
),
'location' => array(
'#type' => 'select',
'#default_value' => isset($_SESSION['grid_filters']['location']) ? $_SESSION['grid_filters']['location'] : '',
'#title' => t('Module'),
'#options' => array(
'' => '',
) + $modules,
),
'upload_status' => array(
'#type' => 'select',
'#default_value' => isset($_SESSION['grid_filters']['upload_status']) ? $_SESSION['grid_filters']['upload_status'] : 'all',
'#title' => t('Upload Status'),
'#options' => array(
'all' => t('All'),
LingotekSync::STATUS_EDITED => t('Edited (needs reupload)'),
LingotekSync::STATUS_CURRENT => t('Current (uploaded)'),
'never' => t('Never uploaded'),
),
'#multiple' => FALSE,
),
);
// Include a content-type filter if there are bundles by which to filter.
$entity_info = entity_get_info($_SESSION['grid_entity_type']);
if (!empty($entity_info['bundles'])) {
$grid_bundles = array_map(function ($val) {
return $val['label'];
}, $entity_info['bundles']);
$filters['content_type'] = array(
'#type' => 'select',
'#default_value' => isset($_SESSION['grid_filters']['content_type']) ? $_SESSION['grid_filters']['content_type'] : 'all',
'#title' => t('Content Type(s)'),
'#options' => array(
'all' => t('All'),
) + $grid_bundles,
'#multiple' => TRUE,
);
}
return lingotek_grid_process_elements($filters, '', '__filter');
// Add prefix and suffix to the name of each filter element
}