You are here

public function TMGMTEntitySourceUIController::overviewForm in Translation Management Tool 7

Overrides TMGMTDefaultSourceUIController::overviewForm

File

sources/entity/ui/tmgmt_entity_ui.ui.inc, line 76

Class

TMGMTEntitySourceUIController
Generic entity ui controller class for source plugin.

Code

public function overviewForm($form, &$form_state, $type) {
  $form += $this
    ->overviewSearchFormPart($form, $form_state, $type);
  $form['items'] = array(
    '#type' => 'tableselect',
    '#header' => $this
      ->overviewFormHeader($type),
    '#empty' => t('No entities matching given criteria have been found.'),
    '#attributes' => array(
      'id' => 'tmgmt-entities-list',
    ),
  );

  // Load search property params which will be passed into
  $search_property_params = array();
  $exclude_params = array(
    'q',
    'page',
  );
  foreach ($_GET as $key => $value) {

    // Skip exclude params, and those that have empty values, as these would
    // make it into query condition instead of being ignored.
    if (in_array($key, $exclude_params) || $value === '') {
      continue;
    }
    $search_property_params[$key] = $value;
  }
  foreach ($this
    ->getEntitiesTranslationData($type, $search_property_params) as $data) {
    $form['items']['#options'][$data['entity_id']] = $this
      ->overviewRow($data);
  }
  $form['pager'] = array(
    '#markup' => theme('pager', array(
      'tags' => NULL,
    )),
  );
  return $form;
}