TranslateFormBase::translateFilterLoadStrings

protected TranslateFormBase::translateFilterLoadStrings()

Builds a string search query and returns an array of string objects.

Return value

\Drupal\locale\TranslationString[] Array of \Drupal\locale\TranslationString objects.

File

core/modules/locale/src/Form/TranslateFormBase.php, line 79

Class

TranslateFormBase
Defines the locale user interface translation form base.

Namespace

Drupal\locale\Form

Code

protected function translateFilterLoadStrings() {
  $filter_values = $this->translateFilterValues();

  // Language is sanitized to be one of the possible options in
  // translateFilterValues().
  $conditions = array('language' => $filter_values['langcode']);
  $options = array('pager limit' => 30, 'translated' => TRUE, 'untranslated' => TRUE);

  // Add translation status conditions and options.
  switch ($filter_values['translation']) {
    case 'translated':
      $conditions['translated'] = TRUE;
      if ($filter_values['customized'] != 'all') {
        $conditions['customized'] = $filter_values['customized'];
      }
      break;

    case 'untranslated':
      $conditions['translated'] = FALSE;
      break;

  }

  if (!empty($filter_values['string'])) {
    $options['filters']['source'] = $filter_values['string'];
    if ($options['translated']) {
      $options['filters']['translation'] = $filter_values['string'];
    }
  }

  return $this->localeStorage->getTranslations($conditions, $options);
}
doc_Drupal
2016-10-29 09:49:12
Comments
Leave a Comment

Please login to continue.