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...
Working content type (Blog Entry)

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

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?

Comments

amaisano’s picture

Issue summary: View changes
amaisano’s picture

Issue summary: View changes
amaisano’s picture

Issue summary: View changes
anon’s picture

Issue tags: -json

The 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.

amaisano’s picture

There 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.

anon’s picture

Make sure you saves js errors in the console between page loads, else you wont see them.

acy76’s picture

I 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.

anon’s picture

Status: Active » Closed (cannot reproduce)
gfed’s picture

Status: Closed (cannot reproduce) » Needs review
gfed’s picture

Had 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.

anon’s picture

Status: Needs review » Closed (cannot reproduce)
sfo_oxy’s picture

Thanks to gfed #10 comment i managed to fix the problem.

In .htaccess i've added this line :

php_value max_input_vars 5000

Final result :

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_flag magic_quotes_gpc                 off
  php_flag magic_quotes_sybase              off
  php_flag register_globals                 off
  php_flag session.auto_start               off
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_flag mbstring.encoding_translation    off
  php_value max_input_vars                  5000
</IfModule>
merilainen’s picture

Just 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

dale42’s picture

Have 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 0

In my situation, we have a text field with value = unlimited. There were 12 text fields.

dysrama’s picture

Status: Closed (cannot reproduce) » Needs review

This 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?

PascalAnimateur’s picture

StatusFileSize
new14.93 KB

I 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.

anon’s picture

dysrama: A feature would be nice to have.

anon’s picture

Status: Needs review » Needs work
anon’s picture

Well, 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.

igorski’s picture

I can confirm, that the same happens with TinyMCE.
I get a “TypeError: Drupal.linkit.populateFields is not a function”.

otto manninen’s picture

I 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

jenlampton’s picture

Issue tags: +max_input_vars

tagging

hayzer’s picture

I 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.

gmclelland’s picture

Issue summary: View changes
StatusFileSize
new126.73 KB

I 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.

twod’s picture

I 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

anon’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.72 KB

Try this patch and see if it works.

Jinghan Wang’s picture

Subscribe. Same issue here. To me, it seems Linkit will broke on "big page".

Jinghan Wang’s picture

@anon Thanks so much. Your patch works in my case.

anon’s picture

Status: Needs review » Reviewed & tested by the community

as of #28

anon’s picture

Status: Reviewed & tested by the community » Fixed

  • anon committed 297183b on 7.x-3.x
    Issue #2249097 by anon: CKeditor dialogue works on one node type, broken...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

amaisano’s picture

Thanks 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!

loopy1492’s picture

Even with the new patch, I had to use @sfo_oxy 's solution in #12. It worked for me.

shaktik’s picture

@anon Thank you very much. Your patch working fine.

pixelsweatshop’s picture

Running 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.

RAWDESK’s picture

Our 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.