You are here

function lingotek_add_menu_link_form in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lingotek.module \lingotek_add_menu_link_form()
  2. 7.6 lingotek.module \lingotek_add_menu_link_form()
1 call to lingotek_add_menu_link_form()
lingotek_get_node_settings_form in ./lingotek.module
Display the Lingotek node-settings form

File

./lingotek.module, line 2898

Code

function lingotek_add_menu_link_form($form, $form_state, $node) {
  if (isset($form['menu']['link'])) {

    // if menu translation is enabled, if the default language is english,
    // and if either 'english' or 'language neutral' is selected for the node
    // being created, then show the option to set the menu item as 'und' for
    // i18n_string translation.
    $i18n_language = 'en';
    $form['menu']['link']['lingotek_translate'] = array(
      '#type' => 'select',
      '#title' => 'Menu translation through Lingotek',
      '#description' => t('Select whether to allow this link to be translated into all enabled languages.'),
      '#default_value' => isset($form_state['node']->menu['language']) ? $form_state['node']->menu['language'] : LANGUAGE_NONE,
      '#options' => array(
        LANGUAGE_NONE => 'Allow link to be translated',
        'en' => 'Show link only in English',
      ),
      '#prefix' => '<div id="edit-menu-english">',
      '#suffix' => '</div>',
    );
    $form['menu']['link']['nonenglish_info'] = array(
      '#markup' => t('<div id="edit-menu-non-english">Note: This menu item will be visible only in this node\'s currently selected language.  If you want this menu link to be available for all languages, you must add it directly through the Menus administration tool as an English string and then save the menu item as "Language Neutral".</div>'),
      '#prefix' => '<div id="edit-menu-non-english">',
      '#suffix' => '</div>',
    );
  }
  return $form;
}