You are here

function lingotek_grid_define_columns in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lingotek.bulk_grid.inc \lingotek_grid_define_columns()
  2. 7.5 lingotek.bulk_grid.inc \lingotek_grid_define_columns()
  3. 7.6 lingotek.bulk_grid.inc \lingotek_grid_define_columns()

Defines which columns should be shown for source and target tables, and what the defaults should be.

Parameters

bool $source: Changes whether settings for source or target variables are output

Return value

array $columns Associative array with two important inner arrays: 1: 'columns' points to the allowed columns, 2: 'defaults' points to the base defaults to use when resetting the customization The 'columns' and 'defaults' arrays are output with the keys and the values being the same

2 calls to lingotek_grid_define_columns()
lingotek_grid_build_column_checkboxes in ./lingotek.bulk_grid.inc
Builds the checkbox elements for customizing The Grid's columns Uses predefined defaults specified in 'lingotek_grid_define_columns'
lingotek_grid_reset_columns in ./lingotek.bulk_grid.inc
Cleans up the grid_custom or config_custom session array, restoring the predefined defaults.

File

./lingotek.bulk_grid.inc, line 1457

Code

function lingotek_grid_define_columns($entity_type) {
  $columns = array();
  $columns['columns'] = array(
    'marked' => 'marked',
    'nid' => 'nid',
    'content_type' => 'content_type',
    'title' => 'title',
    'language' => 'language',
    'translations' => 'translations',
    'configuration' => 'configuration',
    'document_id' => 'document_id',
    'workflow_id' => 'workflow_id',
    'workflow_name' => 'workflow_name',
    'changed' => 'changed',
    'last_uploaded' => 'last_uploaded',
    'actions' => 'actions',
  );
  $columns['defaults'] = array(
    'title' => 'title',
    'language' => 'language',
    'translations' => 'translations',
    'configuration' => 'configuration',
    'content_type' => 'content_type',
    'actions' => 'actions',
    'changed' => 'changed',
  );
  if ($entity_type == 'taxonomy_term') {
    $columns['columns']['description'] = 'description';
    $columns['defaults']['description'] = 'description';
  }
  if ($entity_type == 'bean') {
    $columns['columns']['label'] = 'label';
  }
  if ($entity_type === 'paragraphs_item') {
    $columns['columns']['parent_node_id'] = 'parent_node_id';
    $columns['columns']['paragraph_snippet'] = 'paragraph_snippet';
  }
  return $columns;
}