function lingotek_grid_build_column_checkboxes in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.bulk_grid.inc \lingotek_grid_build_column_checkboxes()
- 7.4 lingotek.bulk_grid.inc \lingotek_grid_build_column_checkboxes()
- 7.5 lingotek.bulk_grid.inc \lingotek_grid_build_column_checkboxes()
Builds the checkbox elements for customizing The Grid's columns Uses predefined defaults specified in 'lingotek_grid_define_columns'
1 call to lingotek_grid_build_column_checkboxes()
File
- ./
lingotek.bulk_grid.inc, line 640
Code
function lingotek_grid_build_column_checkboxes($form_state) {
$prefix = '';
$suffix = '__custom';
// Suffix specified because the filter submit function differentiates based on this tag and puts the keys into the session variable as such
$entity_type = $form_state['entity_type'];
$columns = lingotek_grid_define_columns($entity_type);
// Allowed columns and defaults for source and target grids are defined here
$column_elements = array(
'nid' => array(
'#type' => 'checkbox',
'#title' => t('ID'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'nid' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'nid' . $suffix] : in_array('nid', $columns['defaults']),
),
'content_type' => array(
'#type' => 'checkbox',
'#title' => t('Content Type'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'content_type' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'content_type' . $suffix] : in_array('content_type', $columns['defaults']),
),
'title' => array(
'#type' => 'checkbox',
'#title' => t('Title'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'title' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'title' . $suffix] : in_array('title', $columns['defaults']),
),
'description' => array(
'#type' => 'checkbox',
'#disabled' => 'true',
'#title' => t('Description'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'nid' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'description' . $suffix] : in_array('description', $columns['defaults']),
),
'language' => array(
'#type' => 'checkbox',
'#title' => t('Source Uploaded'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'language' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'language' . $suffix] : in_array('language', $columns['defaults']),
),
'translations' => array(
'#type' => 'checkbox',
'#title' => t('Translations'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'translations' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'translations' . $suffix] : in_array('translations', $columns['defaults']),
),
'configuration' => array(
'#type' => 'checkbox',
'#title' => t('Profile'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'configuration' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'configuration' . $suffix] : in_array('configuration', $columns['defaults']),
),
'document_id' => array(
'#type' => 'checkbox',
'#title' => t('Doc ID'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'document_id' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'document_id' . $suffix] : in_array('document_id', $columns['defaults']),
),
'workflow' => array(
'#type' => 'checkbox',
'#title' => t('Workflow'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'workflow' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'workflow' . $suffix] : in_array('workflow', $columns['defaults']),
),
'changed' => array(
'#type' => 'checkbox',
'#title' => t('Last Modified'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'changed' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'changed' . $suffix] : in_array('changed', $columns['defaults']),
),
'last_uploaded' => array(
'#type' => 'checkbox',
'#title' => t('Last Uploaded'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'last_uploaded' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'last_uploaded' . $suffix] : in_array('last_uploaded', $columns['defaults']),
),
'locale_progress_percent' => array(
'#type' => 'checkbox',
'#title' => t('Target Progress Percentage'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'locale_progress_percent' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'locale_progress_percent' . $suffix] : in_array('locale_progress_percent', $columns['defaults']),
),
'progress_updated' => array(
'#type' => 'checkbox',
'#title' => t('Progress Last Updated'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'progress_updated' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'progress_updated' . $suffix] : in_array('progress_updated', $columns['defaults']),
),
'last_downloaded' => array(
'#type' => 'checkbox',
'#title' => t('Time Last Downloaded'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'last_downloaded' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'last_downloaded' . $suffix] : in_array('last_downloaded', $columns['defaults']),
),
'actions' => array(
'#type' => 'checkbox',
'#title' => t('Actions'),
'#default_value' => isset($_SESSION[$entity_type . '_custom'][$prefix . 'actions' . $suffix]) ? $_SESSION[$entity_type . '_custom'][$prefix . 'actions' . $suffix] : in_array('actions', $columns['defaults']),
),
);
if ($form_state['entity_type'] == 'taxonomy_term') {
$column_elements['description']['#disabled'] = 'true';
$column_elements['title']['#disabled'] = 'true';
}
$column_elements = array_intersect_key($column_elements, $columns['columns']);
// Reduces the output columns to the defaults specified in 'lingotek_grid_define_columns'
return lingotek_grid_process_elements($column_elements, $prefix, $suffix);
// adds prefixes and suffixes to the elements
}