/** * Tests in-place editor attachments when the Editor module is present. */ public function testAttachments() { $this->editorSelector = $this->container->get('quickedit.editor.selector'); $editors = array('editor'); $attachments = $this->editorSelector->getEditorAttachments($editors); $this->assertIdentical($attachments, array('library' => array('editor/quickedit.inPlaceEditor.formattedText')), "Expected attachments for Editor module's in-place editor found."); }
/** * 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 \Drupal\Core\Ajax\AjaxResponse * The Ajax response. */ public function attachments(Request $request) { $response = new AjaxResponse(); $editors = $request->request->get('editors'); if (!isset($editors)) { throw new NotFoundHttpException(); } $response->setAttachments($this->editorSelector->getEditorAttachments($editors)); return $response; }
/** * 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 \Drupal\Core\Ajax\AjaxResponse * The Ajax response. */ public function attachments(Request $request) { $response = new AjaxResponse(); $editors = $request->request->get('editors'); if (!isset($editors)) { throw new NotFoundHttpException(); } $elements['#attached'] = $this->editorSelector->getEditorAttachments($editors); drupal_process_attached($elements); return $response; }