While this patch has made it easier for non-coders to add related links, IMO, this can be improved.

A few criteria/considerations:

  • There ought to be separate inputs for each field - URL, title (perhaps description) etc.
  • The user shouldn't have to refresh the page to add a new link [or in other words a new set of input fields].
  • Link order (weighting) and removal of added links should be addressed, again, without a page refresh.
  • Users with JS disabled should be able to use the textarea we have currently, i.e. graceful degradation.

IMO, the relatedlinks fieldset in the node form could look something like this:

1. google      [down]    [delete]
2. yahoo  [up] [down]    [delete]
3. drupal [up]           [delete]

Add link: [URL input] [title input] [add link]

JS could perhaps *hide* the currently used textarea for manual links and replace it with the above UI (in a float). Clicking the [add link] will essentially populate the existing textarea (which is not visible to the user).

The [up] and [down] buttons control weight, while the delete button removes a link. This will also accomplish the weight issue without the need of an extra weight field.

Hope that made sense. Your thoughts on this are appreciated. And patches are very welcome!

Cheers,
-K

Comments

moshe weitzman’s picture

If you start creating textboxes on the fly, you will probably need to use the #DANGEROUS_SKIP_CHECK feature of fapi. And thats exciting ... poll.module should do same.

Zen’s picture

Ideally, the dynamically created elements will not need to be a part of the form. They will essentially be populating the usual manual links text area (which will be hidden with display:none).

That's the idea at any rate.

-K

newdru’s picture

Zen, have you worked on your recommendation or made any headway with it?

I'd like this same functionality myself..

If not.. can anybody point me to some code examples that would allow this type of functionality.

thanks

Zen’s picture

Assigned: Unassigned » Zen

FYI: I've just committed an initial patch for this feature. Still a work in progress.

-K

Zen’s picture

There have been a couple of updates to this in HEAD.

Zen’s picture

Version: master » 5.x-2.x-dev
Status: Active » Fixed

This is pretty much done with issues pending being of a cosmetic nature. New branch created.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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