function theme_editablefields_formatter in Editable Fields 6.3
Default theme implementation for editablefields_modal. RESPONDER
File
- plugins/
editables/ cck.inc, line 97
Code
function theme_editablefields_formatter($element) {
static $fields = array();
static $views_field_edit_column = array();
$responder = 'modal';
$node = $element['#node'];
// ajax-responder.js needs to be before editablefields.js
require_once drupal_get_path('module', 'editablefields') . '/plugins/responders/' . $responder . '.inc';
ctools_add_js('ajax-responder');
drupal_add_js(drupal_get_path('module', 'editablefields') . '/editablefields.js');
ctools_include('plugins');
ctools_include('ajax');
ctools_include('modal');
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'];
$function = 'editablefields_' . $responder . '_wrapper_id';
$css_id = $function($element);
$link_text = '';
foreach ($element as $delta => $item) {
if (is_integer($delta)) {
$items[$delta] = $item['#item'];
}
}
$link_text = editablefields_cck_render($field, $items, $node, $responder);
$link_text = '<div id="' . $css_id . '">' . $link_text . '</div>';
$function = 'editablefields_' . $responder . '_text_button';
$output = $function($link_text, 'editablefields/nojs/modal/cck/' . $element['#node']->nid . '/' . $element['#field_name'], check_plain($link_text));
return $output;
}