You are here

function editablefields_modal in Editable Fields 6.3

RESPONDER Menu callback.

Parameters

$method : 'ajax' or 'nojs'

$responder: The ajax responder being used for this page request.

$node: The node to be edited.

$field_name: The field to be edited.

Return value

void

1 string reference to 'editablefields_modal'
modal.inc in plugins/responders/modal.inc
Editablefields CTools modal plugin.

File

plugins/responders/modal.inc, line 56
Editablefields CTools modal plugin.

Code

function editablefields_modal($method, $responder = 'modal', $editable, $object, $field_name = NULL) {
  drupal_add_js(drupal_get_path('module', 'editablefields') . '/editablefields.js');
  ctools_include('ajax');
  ctools_include('modal');
  ctools_include('plugins');
  ctools_modal_add_js();
  $form_state = array(
    'ajax' => TRUE,
    'node' => $object,
    '_params' => array(
      'field_name' => $field_name,
      'node_type' => $object->type,
    ),
  );
  $output = ctools_modal_form_wrapper('editablefields_' . $editable . '_form', $form_state);
  if (!$output) {
    $output = array();
    if ($replacements = $form_state['replacements']) {
      foreach ($replacements as $nid => $replacement) {
        $css_id = editablefields_modal_wrapper_id(array(
          '#type_name' => $object->type,
          '#field_name' => $field_name,
          '#node' => $object,
        ));
        $function = 'editablefields_' . $editable . '_render';
        $html = $function($replacement['field'], $replacement['item'], $replacement['object'], 'modal');
        $output[] = ctools_ajax_command_replace('#' . $css_id, '<div id="' . $css_id . '">' . $html . '</div>');
      }
    }
    $output[] = ctools_modal_command_dismiss();
  }
  ctools_ajax_render($output);
}