originally from #335191: CCK fields formatting (support Image- and Filefield)

>>If linking is disabled, can it be made to look exactly as if it's local? Is all the formatting from the source preserved? Q3 What about links, e.g. inline html, actual link-type fields, Glossary module flags, do these all look and behave the same as in the original node?

>No, all formatting is removed since I use check_plain()/l() for security reasons and to avoid infinite referencing (imagine an embedded textfield embeds itself with a Linodef tag). If you think it is important to preserve certain formatting than open a separate issue and list the tags you need (HTML filter, flags etc). Coding that could take a while or is limited to a small amount of tags because I have to heed possible security flaws.

----
Again this may be (are probably) separate issues, but in general my feature request is:

Support links in the source node continuing to be links in the target.

These examples come immediately to mind, you're probably aware of more:

Use case - software documentation site, different node types:

"GlossaryEntry" nodes: short definitions of specific term topics with "hard edges", with "for more detail" links to TopicTerm nodes, automatic synonym and related terms "see also" functionality offered by Glossary module.

"TopicTerm" nodes are more in depth, conceptual definition/overview/background information 1:1 with the GlossaryEntries

"HowTo" and "Snippet" nodes store procedural step-by-step and code examples respectively

"Link" nodes simply point to an off-site resource, no local content

"Narrative" nodes are used where the edges aren't clear, mixing conceptual and procedural, intersection topics

I'd like to use Linodef as follows: Glossary entries pull their title from the Title field and the definition from the CCK definition_field of the same-name Topic term node - only one place to edit everything about that term rather than having to keep the two in sync.

Other fields in the Topic term contain different levels of detail, perhaps simply "intro-overview" and "in-depth details". Perhaps some nodes of this type would pull in canonical Snippets as examples.

Narratives would [pull in | link to] overview or in-depth content from different Topic term nodes, [pull in | link to] relevant HowTo's, Links and/or Snippets as needed via Linodef's inline tags. Ideally the only "local text" actually stored in Narratives would be meta information and connective writing for flow, not substantive technical information.

The data from these four source node types would be referenced in many different Narratives, obvious advantages in re-use and only needing to be kept up to date in one place.

Each of these different node types could be navigated to and displayed independently, classified by audience, difficulty, software version, editorial review tags etc., and/or grouped/filtered by taxonomy, date, author, rated/voted on, access controlled.

With Glossary automatically tagging the terms as they're used in the content with links back to the canonical definitions.

This use case would require that the links referenced in Link nodes, the glossary tags etc. get pulled through as active links in the target Narrative nodes.

The way I see it your module has the potential to make Drupal a killer community documentation/authoring platform.

Thanks for considering my ideas (and just for taking the time to read them! :)

Comments

Roi Danton’s picture

In my local testinstallation it works now and takes all filter one has enabled into consideration and removes html bugs caused by default Drupal line break converter. Also I could solve the self referencing issue.

But still the cross referencing issue is unsolved i.e. including a field that includes your field causes a white screen and stop that node to work. Or including a field that includes a field that includes the field that is included would be cause such an issue, too. Currently I have no idea how to prevent that besides not parsing linodef tags inside linodef tags what is not a plain solution for the user.

HansBKK’s picture

Assigned: Unassigned » Roi Danton

Roi, sorry but I'm not fully getting it. Let me paraphrase my understanding and you let me know if I got anything wrong:

You have already looked at supporting this requested feature, done some coding and tested it (Really? Wow!)

You have allowed the user to define an input filter as to what tags Linodef will allow to pass through from the source node to be rendered in the target node. (excellent idea!)

There was some problem about line breaks, but you overcame that.

OK so far?

Regarding the circular reference problem, is it only happening when you are displaying content, or even when just linking??

Here's a proposed (and hopefully temporary) workaround:

  • you make this facility optional, off by default
  • if enabled, you print a strong warning "don't create circular references or you will get (describe the symptom)!!" on the config screen, where it always sits as a reminder to the admin as long as the feature is enabled.

You're right, we definitely need to be able to "nest" our linking references many generations, but perhaps if this facility were enabled you would only allow one generation deep for displaying text, and after that you would pass it through check_plain.

Also note that of course links to external sites would NEVER have this problem, so you'd be safe allowing those, right?

Or if you can find a way for your module to catch the problem (require a Preview before Save?) and flash up a "circular reference!" warning to the user?

Sorry if these are silly suggestions, just thinking while I'm writing, and I'm no programmer. . .

And in any case thanks SO much for not just considering but actually looking at implementing my feature request.

For people coming across this in the meantime, I'm looking at Related Content as an alternative - only does whole-node, not field-level. . .

Roi Danton’s picture

Yes, and it works now. It uses the input format that the Admin defined as the default one.

I've removed the Linodef tags from the embedded string. This is the plainest solution also for the end user because he still can embed the Linodef tag included in the other field in his field, too. So the infinite recursion won't appear.

Thanks for your proposals but I want to keep it as simple as possible with almost no settings the admin has to adjust.

Roi Danton’s picture

Component: Code (general) » Filter
Status: Active » Fixed

Committed to Drupal 6 branch.

Roi Danton’s picture

Title: Enable "pass-through" of embedded links » Enable "pass-through" of filtered layout of embedded fields

Updated title.

Hint: This is valid for the filter itself. In the button list, popup window or autocomplete field all fields still have plain text for usability and technical reasons.

Maybe for your purpose Related Content is better since Linodef can't "nest" its own linking references many generations by design. (I can't set a limit because I can't follow the nesting - at least as long I don't include a relationship table - need time to think about that)

HansBKK’s picture

>I've removed the Linodef tags from the embedded string.

Do you mean in the target display the link is now a regular <a href tag?

Thanks so much Roi, you're the quickest updater out there! :)

Roi Danton’s picture

Example: We have two nodes
Node 129 with field_example
Node 134 with field_example

In field_example of Node 129 you enter [#134:field_example].
In field_example of Node 134 you enter [#129:field_example].

Normally this would cause an infinite recursion and both nodes would break (white window) because the rendered result in the field_example of e.g. Node 129 would look like this:
- Content of field_example 134 embedded by Linodef tag in Node 129.
- Content of field_example 129 embedded by Linodef tag in Node 134.
- Content of field_example 134 embedded by Linodef tag in Node 129 because in the step before, 129 is embedded again.
- etc etc
I can't set a limit (e.g. stop embedding after two times) and a limit would also do confusing the user. Hence the current result is the following:
- Content of field_example 134 embedded by Linodef tag in Node 129 and thats it.

If you want to embed the tags that are embedded in Node 134, too (in this example Node 129) you have to write down the Linodef tags that are in Node 134 in Node 129 again. It's the simplest and most transparent tradeoff currently.

HansBKK’s picture

Status: Fixed » Closed (fixed)

Thanks, I'm sure it'll all be clearer when I actually try it :)

Roi Danton’s picture

Status: Closed (fixed) » Fixed

Reopened since some testing is appreciated before release of RC2.

Status: Fixed » Closed (fixed)

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