You are here

function _localize_fields_admin_form in Localize Fields 7

Localize Fields settings.

Parameters

array $form:

array &$form_state:

Return value

array

1 string reference to '_localize_fields_admin_form'
localize_fields_menu in ./localize_fields.module
Implements hook_menu().

File

./localize_fields.admin.inc, line 14
Drupal Localize Fields module

Code

function _localize_fields_admin_form($form, &$form_state) {
  $form['#attributes'] = array(
    'autocomplete' => 'off',
    'class' => array(
      'localize-fields-admin-form',
    ),
  );
  $form['#attached']['css'][] = drupal_get_path('module', 'localize_fields') . '/css/localize_fields.admin.css';
  $form['localize_fields_help'] = array(
    '#type' => 'markup',
    '#markup' => '<p><b>' . l(t('About Localize Fields and it\'s drush script and sub modules', array(), array(
      'context' => 'module:localize_fields',
    )), 'admin/help/localize_fields', array(
      'attributes' => array(
        'target' => 'blank',
      ),
    )) . '</p></b>',
  );
  $form['localize_fields_usecontext'] = array(
    '#type' => 'radios',
    '#title' => t('Use translation context', array(), array(
      'context' => 'module:localize_fields',
    )),
    '#description' => t('Also applies to drush localize-fields, unless given the --usecontext option which overrules.', array(), array(
      'context' => 'module:localize_fields',
    )),
    '#default_value' => variable_get('localize_fields_usecontext', LocalizeFields::USE_CONTEXT_NONCONTEXT),
    '#options' => array(
      LocalizeFields::USE_CONTEXT_NONCONTEXT => t('Yes, and fall back on non-context.', array(), array(
        'context' => 'module:localize_fields',
      )),
      LocalizeFields::USE_CONTEXT => t('Yes, no fallback. Clean and predictable, but not the right choice if you\'re only testing this module.', array(), array(
        'context' => 'module:localize_fields',
      )),
      0 => t('No. And translations may get mixed up, just like ordinary translation.', array(), array(
        'context' => 'module:localize_fields',
      )),
    ),
  );
  $form['localize_fields_tentative'] = array(
    '#type' => 'checkbox',
    '#title' => t('Don\'t translate the label and/or description that gets passed to other widget alterers', array(), array(
      'context' => 'module:localize_fields',
    )),
    '#description' => t('Localize Fields defaults to translate labels/descriptions of the $context arg passed to hook_field_widget_form_alter() implementations,!nlthus securing that other modules \'see\' translated labels/descriptions.!nlChecking this will break description translation (though only for field types which Token\'s replacement actually works for ;-).', array(
      '!nl' => '<br/>',
    ), array(
      'context' => 'module:localize_fields',
    )),
    '#default_value' => variable_get('localize_fields_tentative', 0),
  );
  $form['localize_fields_source_add_row'] = array(
    '#type' => 'textfield',
    '#title' => t('Default source text of \'!add_row\' button labels', array(
      '!add_row' => t('Add another item'),
    ), array(
      'context' => 'module:localize_fields',
    )),
    '#description' => t('For multi-valued fields.', array(), array(
      'context' => 'module:localize_fields',
    )),
    '#default_value' => variable_get('localize_fields_source_add_row', 'Add another item'),
    '#size' => 30,
  );

  // Add the UI module's fields.
  if (module_exists('localize_fields_ui')) {
    module_load_include('inc', 'localize_fields_ui', 'localize_fields_ui.admin');
    _localize_fields_ui_admin_form($form);
  }
  return system_settings_form($form);
}