I have two node types with the same fields, and the body fields are CKeditor4 enabled (through WYSIWYG, not the CK module). LinkIt has been setup for the body editor profile for each of these content types.
The LinkIt button works correctly on my "Blog Entry" content type (dialogue pops up, autocomplete works, insert works).
However, on my "Basic Page" content type, the LinkIt button opens a broken dialogue (no CSS styles), fails to search/auto-complete (nothing happens), and when "Insert Link" is clicked, the page navigates away to a raw JSON response.
I have read this is an issue cause by faulty JS outside of LinkIt, but the debugger is not throwing any JS errors on either content type's edit page.
The only discrepancy I could find was in the JSON request/response on the initial click of the LinkIt button. See images:
Working result (blog entry): http://drupal.org/files/issues/Screen%20Shot%202014-04-24%20at%203.12.42...

Broken result (basic page): http://drupal.org/files/issues/Screen%20Shot%202014-04-24%20at%203.13.34...

On the "broken" content type, there is only one file requested. On the working content type, after the initial json loads, it loads 4 additional files. This doesn't happen with the former.
Also note the broken content type is using a "theme" value under the JSON "ajaxPageState" object that is not the current page theme. All admin and edit operations load in the "ember" theme environment, not the "mentor" theme, which is what the node displays in after being saved.
What's the deal here? Why are two nearly identical content types telling LinkIt's JSON two different theme values?
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | 2249097-ajax-ids.patch | 1.72 KB | anon |
| #24 | standard_editor.jpg | 126.73 KB | gmclelland |
| #16 | linkit-incomplete-dialog.png | 14.93 KB | PascalAnimateur |
| Screen Shot 2014-04-24 at 3.13.34 PM.png | 331.73 KB | amaisano | |
| Screen Shot 2014-04-24 at 3.12.42 PM.png | 380.73 KB | amaisano |
Comments
Comment #1
amaisano commentedComment #2
amaisano commentedComment #3
amaisano commentedComment #4
anonThe fact that it redirects to a new page with the JSON data tells me that there is something wrong with your javascripts.
If any javascript breaks, they all break.
Check the console for JS errors.
Comment #5
amaisano commentedThere are no console errors. I checked Firebug, Firefox (native) and Chrome and there are no reported errors.
I think the source of the problem lays in the answer, what sets a page's "theme" variable value in Javascript? Still looking into it.
Comment #6
anonMake sure you saves js errors in the console between page loads, else you wont see them.
Comment #7
acy76 commentedI was experiencing a similar problem with minipanels, where the linkit overlay would dump json upon attempting to insert a link. The patch in this issue fixed things for me -- you may want to give that a try.
Comment #8
anonComment #9
gfed commentedComment #10
gfed commentedHad this very issue, nothing seemed to work and apparently nothing at all was special about content types or fields. After much meditation on this, this appears to resolve the issue:
Set your max_input_vars in php.ini to 5000....
Hope it helps.
Comment #11
anonComment #12
sfo_oxy commentedThanks to gfed #10 comment i managed to fix the problem.
In .htaccess i've added this line :
php_value max_input_vars 5000Final result :
Comment #13
merilainen commentedJust commenting here the error I got, which might help to find this issue in future. Has happened to me before and didn't find the solution easily.
So I got this error in the console:
Resource interpreted as Document but transferred with MIME type application/json
Comment #14
dale42Have also experienced this error of no css formatting or JavaScript actions on the Linkit dashboard dialog. The solution was to increase max_input_vars.
For the sake of people googling, the following error was in the error log:
PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0In my situation, we have a text field with value = unlimited. There were 12 text fields.
Comment #15
dysrama commentedThis happens for me as well, only on nodes with a lot of fields. I upped max_input_vars to 2000 from 1000 and then all worked fine until I added another field to do the node. Then I had to set the value to 2200 for it to work.
So anon, to reproduce, add a node with a lot of fields. If you want, I can provide a feature with the content type in question for test?
Comment #16
PascalAnimateur commentedI have the same issue on linkit-3.3, tried configuring max_input_vars to 5000 then 10000 and I still have the same incomplete dialog (no title bar, no profile switcher) with non-working autocomplete (nothing happens after 3 characters). Cancel link doesn't work either (escape on the keyboard works), Insert link returns JSON directly in the browser window.
I'm guessing a newer version of WYSIWYG 2.x-dev broke it in my case... will report back here if I figure it out.Update: It was vertical_tabs_responsive that was messing up the loading of JS files other than its own.
Comment #17
anondysrama: A feature would be nice to have.
Comment #18
anonComment #19
anonWell, think I found an easy way to produce this. (Install simplenews as the child issue states).
Seems like the root issue is a drupal core issue with ajax requests.
The problem is that when we do the ajax request to load the content in the modal, the ajax requests will automatically include an array of id's used in the HTML ajax_html_ids[].
If we add a token tree to the base form, the number of id's will be huge, Over 1000.
Comment #20
igorski commentedI can confirm, that the same happens with TinyMCE.
I get a “TypeError: Drupal.linkit.populateFields is not a function”.
Comment #21
otto manninen commentedI noticed that for me it isn't working on content types that have a viewfield included. There is a bug report already https://www.drupal.org/node/2299687
Comment #22
jenlamptontagging
Comment #23
hayzer commentedI can confirm that we had the same max_input_vars problem. Raising it to 5000 worked around the issue. (See https://www.drupal.org/node/2571737) for my original report.) The basic page in question has a lot of fields attached to it, so I'm now trying to figure out how to minimize those fields to reduce the requirements.
Comment #24
gmclelland commentedI added php_value max_input_vars 5000 to my .htaccess, but it didn't work for me. Probably because I'm using mod_fcgid instead of mod_php.
I'm not sure if it helps, but here is the errors it gave in the Chrome console.

This happens when I'm editing a node and click the linkit button and start typing in linkit's search field. It does show the files in the drop down list, but when you select it and choose insert it takes you to a page that just displays json.
I'm using the latest linkit 3.x-dev with the Ckeditor module with the latest Ckeditor library and Scald-1.x-dev.
For me, the only difference between content types is that the content type that has a paragraph field(https://www.drupal.org/project/paragraphs) added to it is the one that has the problem. The other content type with just a title and body field work fine.
Comment #25
twodI added a workaround for the problem described in #19 to Wysiwyg module 7.x-2.x-dev not long ago. That change could likely be adapted for CKEditor module as well. fd268d7 & 727a208
Comment #26
anonTry this patch and see if it works.
Comment #27
Jinghan Wang commentedSubscribe. Same issue here. To me, it seems Linkit will broke on "big page".
Comment #28
Jinghan Wang commented@anon Thanks so much. Your patch works in my case.
Comment #29
anonas of #28
Comment #30
anonComment #33
amaisano commentedThanks for the patch and commit! Unfortunately we've lost the case I opened this issue with - website, backup and all - so I cannot test. I am glad the patches provided here work for others' use cases though. Good work!
Comment #34
loopy1492 commentedEven with the new patch, I had to use @sfo_oxy 's solution in #12. It worked for me.
Comment #35
shaktik@anon Thank you very much. Your patch working fine.
Comment #36
pixelsweatshop commentedRunning the latest at the time of writing (7.35) and therefore the above patch should have been included in it (was committed a year before it's release) however I am still having this issue. Had to increase php_value max_input_vars to 15000 to get it to finally work.
Comment #37
RAWDESK commentedOur hosting partner resolved it by increasing the max_input_vars to 5000.
No other option addressed above and in https://www.drupal.org/project/linkit/issues/2550845 seemed to be working.