You are here

function quickedit_attachments in Quick Edit 7

Page callback: Returns AJAX commands to load in-place editors' attachments.

Given a list of in-place editor IDs as POST parameters, render AJAX commands to load those in-place editors.

Return value

The Ajax response.

See also

Drupal 8's QuickEditController::attachments()

QuickEditEditorSelector

1 string reference to 'quickedit_attachments'
quickedit_menu in ./quickedit.module
Implements hook_menu().

File

includes/pages.inc, line 95
AJAX endpoint to retrieve & save subforms for fields and re-render fields.

Code

function quickedit_attachments() {
  $editors = $_POST['editors'];
  if (!isset($editors)) {
    return MENU_NOT_FOUND;
  }
  module_load_include('php', 'quickedit', 'includes/QuickEditEditorSelector');
  $editorSelector = new QuickEditEditorSelector();

  // Ensure an AJAX command is generated to load in-place editor attachments.
  $elements['#attached'] = $editorSelector
    ->getEditorAttachments($editors);
  drupal_process_attached($elements);
  return array(
    '#type' => 'ajax',
    '#commands' => array(),
  );
}