You are here

function theme_editablefields_inline in Editable Fields 6.3

Default theme implementation for editablefields_modal.

File

plugins/responders/inline.inc, line 167
Editablefields CTools modal plugin.

Code

function theme_editablefields_inline($element) {
  static $fields = array();
  static $views_field_edit_column = array();
  $node = $element['#node'];

  // ajax-responder.js needs to be before editablefields.js
  ctools_add_js('ajax-responder');
  drupal_add_js(drupal_get_path('module', 'editablefields') . '/editablefields.js');
  ctools_include('ajax');
  ctools_include('plugins');

  // ctools_modal_add_js();

  /**
   * Keep track of the current Views row/column so we can apply
   * Views specified formatter settings.
   */
  if (!empty($node->field_edit)) {
    $view = views_get_current_view();
    if (empty($views_field_edit_column[$view->name][$view->row_index])) {
      $views_field_edit_column[$view->name][$view->row_index] = 0;
    }
    $views_options = $node->field_edit[$views_field_edit_column[$view->name][$view->row_index]];
    $views_field_edit_column[$view->name][$view->row_index]++;
  }
  $type = $element['#type_name'];
  $field_name = $element['#field_name'];
  $context = !empty($node->content) && !empty($node->content[$field_name]) ? $node->content[$field_name]['#context'] : 'full';
  if (empty($fields[$type][$field_name])) {
    $fields[$type][$field_name] = content_fields($field_name, $type);
  }
  $field = $fields[$type][$field_name];
  $options = editablefields_formatter_get_settings($field_name, $type, $context);
  if (!empty($views_options)) {
    $options = $views_options;
  }
  $text_formatter = !empty($options['text_formatter']) ? $options['text_formatter'] : $field['display_settings']['modal']['format'];
  $css_id = editablefields_inline_wrapper_id($element);
  $link_text = '';
  foreach ($element as $delta => $item) {
    if (is_integer($delta)) {
      $link_text .= editablefields_inline_link_text($field, $item['#item'], $text_formatter, $node);
    }
  }
  $link_text = '<div id="' . $css_id . '">' . $link_text . '</div>';
  $output = editablefields_inline_text_button($link_text, 'editablefields/nojs/inline/' . $element['#node']->nid . '/' . $element['#field_name'], filter_xss($link_text, array()), $css_id);
  return $output;
}