You are here

function select_translation_filter_handler::value_form in Select translation 7

Returns a form with configurable options.

Overrides views_handler_filter::value_form

File

./select_translation_filter_handler.inc, line 54
Views select translation filter handler.

Class

select_translation_filter_handler

Code

function value_form(&$form, &$form_state) {
  $form['value'] = array(
    '#type' => 'radios',
    '#title' => t('Select translation selection mode'),
    '#options' => array(
      'original' => t('Use current language ; if not available use original language'),
      'default' => t('Use current language ; if not available use default language ; if not available use original language'),
      'list' => t('Choose language priorities'),
    ),
    '#default_value' => $this->value,
  );
  $form['priorities'] = array(
    '#type' => 'textfield',
    '#title' => t('Language priorities'),
    '#description' => t('If selection mode is set to "Choose language priorities",
                           you can enter here a comma separated list of language codes.
                           The filter will then return the node in the first available langauge
                           in that list ; and the original version if no match were found.<br/><br/>
                           The special value "current" will be replaced with the current language,
                           "default" will be replaced with the default language,
                           and "original" with the original language of each node.
                           <br/><br/>
                           Example:<br/><em>en,fr,current,default,original</em><br/>
                           This will return the version in english if available, if not in french,
                           if not in the current language, if not in the default language.
                           If none are available it will return the original version.'),
    '#default_value' => !empty($this->options['priorities']) ? $this->options['priorities'] : '',
    '#dependency' => array(
      'radio:options[value]' => array(
        'list',
      ),
    ),
  );
  $form['default_language_only'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display default language content *only*, if the currently selected user language is the default site language.'),
    '#description' => t("When you check this option, the order chosen above will be ignored when current language = site default language,\n        instead it will only show translations for the default language. "),
    '#default_value' => !empty($this->options['default_language_only']) ? $this->options['default_language_only'] : 0,
  );
  $form['include_content_without_translation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include content that does not have translations, aka it does not belong to a translation set (tnid = 0)'),
    '#description' => t('Sometimes you have content that is created originally in another language than English (e.g., Chinese)
        and it does not have translations, hence it does not belong to a translation set. With this option checked,
        the Chinese content will appear regardless of current language.'),
    '#default_value' => !empty($this->options['include_content_without_translation']) ? $this->options['include_content_without_translation'] : 0,
  );
  $form['include_content_with_unpublished_translation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Return content in the site default language when a translation for the current language *does* exist, but it is unpublished.'),
    '#description' => t('When you check this option, in addition to the order chosen above, content will be shown in the default site language in the event that the translation in the current language is unpublished.'),
    '#default_value' => !empty($this->options['include_content_with_unpublished_translation']) ? $this->options['include_content_with_unpublished_translation'] : 0,
  );
}