_locale_languages_common_controls

6 locale.inc _locale_languages_common_controls(&$form, $language = NULL)
7 locale.admin.inc _locale_languages_common_controls(&$form, $language = NULL)

Common elements of the language addition and editing form.

Parameters

$form: A parent form item (or empty array) to add items below.

$language: Language object to edit.

Related topics

2 calls to _locale_languages_common_controls()

File

includes/locale.inc, line 224
Administration functions for locale.module.

Code

function _locale_languages_common_controls(&$form, $language = NULL) {
  if (!is_object($language)) {
    $language = new stdClass();
  }
  if (isset($language->language)) {
    $form['langcode_view'] = array(
      '#type' => 'item', 
      '#title' => t('Language code'), 
      '#value' => $language->language,
    );
    $form['langcode'] = array(
      '#type' => 'value', 
      '#value' => $language->language,
    );
  }
  else {
    $form['langcode'] = array(
      '#type' => 'textfield', 
      '#title' => t('Language code'), 
      '#size' => 12, 
      '#maxlength' => 60, 
      '#required' => TRUE, 
      '#default_value' => @$language->language, 
      '#disabled' => (isset($language->language)), 
      '#description' => t('<a href="@rfc4646">RFC 4646</a> compliant language identifier. Language codes typically use a country code, and optionally, a script or regional variant name. <em>Examples: "en", "en-US" and "zh-Hant".</em>', array('@rfc4646' => 'http://www.ietf.org/rfc/rfc4646.txt')),
    );
  }
  $form['name'] = array(
    '#type' => 'textfield', 
    '#title' => t('Language name in English'), 
    '#maxlength' => 64, 
    '#default_value' => @$language->name, 
    '#required' => TRUE, 
    '#description' => t('Name of the language in English. Will be available for translation in all languages.'),
  );
  $form['native'] = array(
    '#type' => 'textfield', 
    '#title' => t('Native language name'), 
    '#maxlength' => 64, 
    '#default_value' => @$language->native, 
    '#required' => TRUE, 
    '#description' => t('Name of the language in the language being added.'),
  );
  $form['prefix'] = array(
    '#type' => 'textfield', 
    '#title' => t('Path prefix'), 
    '#maxlength' => 64, 
    '#default_value' => @$language->prefix, 
    '#description' => t('Language code or other custom string for pattern matching within the path. With language negotiation set to <em>Path prefix only</em> or <em>Path prefix with language fallback</em>, this site is presented in this language when the Path prefix value matches an element in the path. For the default language, this value may be left blank. <strong>Modifying this value will break existing URLs and should be used with caution in a production environment.</strong> <em>Example: Specifying "deutsch" as the path prefix for German results in URLs in the form "www.example.com/deutsch/node".</em>'),
  );
  $form['domain'] = array(
    '#type' => 'textfield', 
    '#title' => t('Language domain'), 
    '#maxlength' => 128, 
    '#default_value' => @$language->domain, 
    '#description' => t('Language-specific URL, with protocol. With language negotiation set to <em>Domain name only</em>, the site is presented in this language when the URL accessing the site references this domain. For the default language, this value may be left blank. <strong>This value must include a protocol as part of the string.</strong> <em>Example: Specifying "http://example.de" or "http://de.example.com" as language domains for German results in URLs in the forms "http://example.de/node" and "http://de.example.com/node", respectively.</em>'),
  );
  $form['direction'] = array(
    '#type' => 'radios', 
    '#title' => t('Direction'), 
    '#required' => TRUE, 
    '#description' => t('Direction that text in this language is presented.'), 
    '#default_value' => @$language->direction, 
    '#options' => array(
      LANGUAGE_LTR => t('Left to right'),
      LANGUAGE_RTL => t('Right to left'),
    ),
  );
  return $form;
}
Login or register to post comments