You are here

function lingotek_content_type_choose_fields_callback in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.2 lingotek.setup.inc \lingotek_content_type_choose_fields_callback()
  2. 7.3 lingotek.setup.inc \lingotek_content_type_choose_fields_callback()

Node Translation Settings - Ajax Callback 1 (Primary)

1 string reference to 'lingotek_content_type_choose_fields_callback'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.setup.inc, line 854

Code

function lingotek_content_type_choose_fields_callback($content_type) {
  $selector = '#content_fields_' . $content_type;
  $commands = array();

  // <span id="showhidelink_' .$value->type .'"><a id="showlink_' .$value->type .'"
  // The CHOOSE FIELDS text is currently shown, switch to HIDE FIELDS
  if (in_array('showlink_' . $content_type, $_REQUEST['ajax_html_ids'])) {
    $link = '<a id="hidelink_' . $content_type . '" href="' . url('admin/config/lingotek/content-type-choose-fields-ajax/' . $content_type) . '" class="use-ajax">hide fields</a>';
    $span_selector = '#showhidelink_' . $content_type;
    $commands[] = ajax_command_html($span_selector, $link);
  }
  if (in_array('hidelink_' . $content_type, $_REQUEST['ajax_html_ids'])) {
    $link = '<a id="showlink_' . $content_type . '" href="' . url('admin/config/lingotek/content-type-choose-fields-ajax/' . $content_type) . '" class="use-ajax">choose fields</a>';
    $span_selector = '#showhidelink_' . $content_type;
    $commands[] = ajax_command_html($span_selector, $link);
  }
  $commands[] = ajax_command_invoke($selector, 'toggle');

  //$commands[] = ajax_command_alert( 'Hiding: ' .$data  );
  return ajax_deliver(array(
    '#type' => 'ajax',
    '#commands' => $commands,
  ));
}