I noticed that in the scald_atom_fetch_atoms function in includes/scald.pages.inc it doesn't grab the scald_atom data array. I am saving some data that associates a scald atom with a node id, and that's stored in the data array, but I can't access that in JS.

I see that when you load a page with the scald dnd library, it actually gets all the atoms from a JSON view because they are loaded by the library. If, however, there is an atom in the WYSIWYG that is not currently in the library, (or the page viewed by the library), then when you load the atomProperties dialog it will call Drupal.dnd.scaldFetch.

At least that's how I understand it - in that scaldFetch function is where I would like to have access to data. I created a small patch.

Thank you very much for your time!

Comments

nagy.balint’s picture

Status: Needs review » Reviewed & tested by the community

I see no issues here so far, since it just adds extra information.

gifad’s picture

While we are at it, we could insert the very same line in mee.module, function mee_ajax_widget_expand($atom), line #546, for the benefit of dndck4's atomProperties.
Thanks,

nagy.balint’s picture

Status: Reviewed & tested by the community » Needs work
gifad’s picture

Status: Needs work » Needs review
StatusFileSize
new970 bytes

this is a combined patch, for both environments

nagy.balint’s picture

@gifad

Thanks!

Should we add the 'provider' => $atom->provider, at the fetch function as well?

gifad’s picture

@nagy.bálint
The 'provider' meta data was added in the context of option 'applicability' to the current atom (ie option handled by a provider); as the options are poorly handled in ckeditor/plugin.js (compared to dndck4/plugin.js), I think this is not really usefull...
BTW, the first important thing to improve in ckeditor/plugin.js would have been to have a 'options' argument in dnd.fetchAtom(), that would allow scald_atom_fetch_atoms(), and later, Drupal.theme.prototype.scaldEmbed(), to render a fully optionned atom; This has been considered in the past, but never implemented, and is now totally obsoleted by the (overridable) theme_mee_widget_embed() function (IMHO).
But it doesn't hurt, of course...

nagy.balint’s picture

StatusFileSize
new1.54 KB

Actually there is one more place to add it, as it should also get there when the library gets displayed initially.

asherry’s picture

Adding it to the initial library load is great, I had to use hook_scald_dnd_library_item_alter otherwise. Thank you very much!

  • nagy.balint committed d85b718 on 7.x-1.x
    Issue #2433885 by nagy.balint, gifad, asherry: Add ->data to fetch...
nagy.balint’s picture

Status: Needs review » Fixed

Committed, Thanks!

Status: Fixed » Closed (fixed)

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