In order to run modules linktonode and linktomenu with FCKEd I've installed FCKEd 2.6.3. , FCKEd module 5.x-2.2-rc1, module linktocontent 5.x-1.7 and tinyMCE 5.x-1.9 due to a dependency. I've configured everything (copied plugins from linktocontent into embedded tinymce plugin directory, enabled nodes and menus in linktocontent admin settings and enabled the modules in question in fckeditor.config.js) and I can see LinkToNode and LinkToMenu buttons in my FCKEd toolbar just fine.

But when I click it, loading icon appears in a popup window and then... nothing - only titles Node title Created Author are displayed where the list of nodes to select from should be.

Firebug tells me the Post request was ltc-type=linktocontent_node&ltc-vocab-id=-1 and the Response { "message": " isn\'t a valid type name for Link to content" }[ ].

Also I get an error message from Drupal saying:

    * warning: Invalid argument supplied for foreach() in /etc/drupal/5/sites/all/modules/linktocontent/linktocontent.module on line 163.
    * warning: Invalid argument supplied for foreach() in /etc/drupal/5/sites/all/modules/linktocontent/linktocontent.module on line 172.

which tracks back to the actual code:

// Sort plugins by weight.
  $weights = variable_get('linktocontent_plugin_weight', array());
  foreach ($plugins as $plugin_name) {
    $plugins[$plugin_name] = (isset($weights[$plugin_name]) ? $weights[$plugin_name] : 0);
  }
  if (is_array($plugins)) {
    asort($plugins, SORT_NUMERIC);
  }
  // Retrieve the data.
  $data = array();
  $args = $_POST;
  foreach ($plugins as $plugin_name => $weight) {
    $data = module_invoke($plugin_name, 'get_data', $args, $data);
  }

Maybe I've overlooked something or maybe this is a known bug since this feature is still new to FCKEd?

Comments

wwalc’s picture

Status: Active » Postponed (maintainer needs more info)

Go to admin/settings/linktocontent and enable both plugins. Then edit Link to node settings (admin/settings/linktocontent/linktocontent_node) and check all available content types. Do the same thing for Link to menu.

Let me know if that worked for you.

charmer’s picture

Well, thanks a lot, it did work - I had both plugins enabled but indeed overlooked to set up the settings for them.

I must say, this feature is very cool and very _important_ for casual users of any CMS and I have two more things to add since they are still on topic:

1) Link to node/menu buttons work somewhat differently - when creating a normal link I select the chunk of text first and then make it a link. By using link to content, if I select the chunk of text, it gets replaced by the title of a node I select then. That's somewhat confusing IMO.

2) I'd like to keep the number of modules I put into my install profile to a minimum. Would it be possible to port Link to content module or possibly develop a new and similar one that wouldn't be dependant on TinyMCE?

Thanks again.

wwalc’s picture

Status: Postponed (maintainer needs more info) » Active

That's great. Took me couple of minutes to figure out what was the problem too.

Regarding 2)
Link to content module has a new maintainer and I believe it is now under heavy development. I suppose we might want to keep support for this module "experimental', but also provide an easy way to install it at this moment.

As you noticed, Link to content module contains lots of TinyMCE dependencies. Patching may not be the easiest thing to do for most people, so it would be great if they also had something ready to download and install.

Here's the modified version of "Link to content" section available in README.txt. Would you be willing to test it and let me know if it's better? Please uninstall current TinyMCE and Linktocontent module, remove TinyMCE folder and upload one of the linktocontent-fckeditor packages.

Modules: Link to content (EXPERIMENTAL)
---------------------------------------
Link to content module can be integrated with FCKeditor.
ATTENTION: this module is not yet compatible with FCKeditor :(

The unofficial version of Link to content module compatible with FCKeditor can be downloaded here:
 * 5.x-1.7	(2007-Oct-04)
     http://drupal.fckeditor.net/download/linktocontent-fckeditor-5.x-1.7.tar.gz 
 * 5.x-2.x-dev	(2008-Mar-06)
     http://drupal.fckeditor.net/download/linktocontent-fckeditor-5.x-2.x-dev.tar.gz

Alternatively, you may apply required changes in the linktocontent code by yourself.
To do this, download the linktocontent module from http://drupal.org/project/linktocontent.
The minimal list of required changes in this module is available here:
  http://drupal.fckeditor.net/linktocontent.patch

Installation:
Follow the instruction from INSTALL.txt attached to the linktocontent module.
Then do the following steps to add Linktocontent button to the FCKeditor toolbar:

By default, FCKeditor module comes with two plugins that allows you to use linktocontent and linktonode features.
You can enable any (or even both) of them.

   1. Open /drupal/modules/fckeditor/fckeditor.config.js and uncomment these three lines:

            FCKConfig.PluginsPath = '../../plugins/' ;
            FCKConfig.Plugins.Add( 'linktonode', 'en,pl' ) ;
            FCKConfig.Plugins.Add( 'linktomenu', 'en,pl' ) ;

   2. The second step is to add buttons to the toolbar (in the same file).
      The button names are: LinkToNode, LinkToMenu. 
      For example if you have a toolbar with an array of buttons defined as follows:

      ['Link','Unlink','Anchor']

      simply add those two buttons at the end of array (or somewhere in the middle):

      ['Link','Unlink','LinkToNode','LinkToMenu','Anchor']

      (remember about single quotes).
charmer’s picture

It works!

I went with 5.x-2.x-dev and proceeded as you instructed.

Also, I'm no programmer, but I can see the in the patch file that the number of changes is very small and l have an impression that it may not be a hard work at all to accomodate the module so that it would detect the editor installed or check for its existence after the admin of the site sets either editor up. After all, LinkToContent module is compatible with both editors.

If this is indeed the case it may a good idea to bring this issue to a new LinkToContent maintainer's attention. What do you think?

Thanks again.

wwalc’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

charmer’s picture

Status: Closed (fixed) » Active

Any chance FCKEditor could be made compatible with D6 version of linktocontent module?

http://drupal.org/node/252938

wwalc’s picture

Status: Active » Closed (fixed)

Because Link to content has not been ported to D6, an experimental version of this module with FCKeditor support is available since some time, check README.txt attached to FCKeditor module for instructions. Please create another separate issue if you find any errors in it.