First of all, excellent concept, I've got immediate use for this.
Sorry to lump all these together, if I have further questions or put in feature requests I'll split them into separate issues, or if you prefer let me know and I'll split them up before you answer. Thanks in advance. . .
Q1 If linking is disabled, can it be made to look exactly as if it's local?
Q2 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?
Q4 Does it respect node-access security? Q5 What about CCK field-level security?
Q6 Is there any way to back-reference from the source, so if I've embedded content from one field in five other nodes I can quickly review the context in the target locations when editing the source content, or confirm all the targets are deleted before I delete the source?
OT
Q7 Any (future?) support for sharing display of CCK image fields, and if so, different imagecache derivative versions?
Q8 How close do you reckon this is to being ready for production site use?
Q9 Any chance of a D5 backport once you've gone stable? If not this still looks useful enough for me to maybe make the jump to D6, but I'm still waiting for some other key modules to be upgraded.
Comments
Comment #1
Roi Danton CreditAttribution: Roi Danton commentedIf I begin to work on one of the questions/issues or you have further ideas to one question then a separate issue should be opened.
Q1 No, see answer Q2/3 (if I understood your question correct).
Q2/3 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.
Q4 Yes. Now details can be found at the drupal.org documentation (I've copied the page from the help documentation included in Linodef).
Q5 Linodef only uses default permissions. Permissions from other modules (e.g. node based, CCK based) are not supported yet. Though it shouldn't be difficult to include support at least for the CCK submodule Content Permissions.
Q6 Yes there are ways but it's not intended for Linodef (I want to keep Linodef lightweight): The tags are simply saved as content in the textfield. and I don't want that Linodef modifies the database layout (an extra column for each node could be added which contains IDs where the tag is used). But: This could be a task for Inline API. I recommend to mention it there.
Q7 I hadn't had a look into the code of image field/file field yet. I assume it's doable but I can't promise if it'll be done in the near future.
Q8 With rc2 I'll introduce a slightly new tag layout for no links ([#IDnl] instead of [#nlID]). Afterwards I don't expect further chances in tag layout, so rc2 should be future safe for production use. Furthermore it uses default Drupal access rights and there is no (known) lack of security.
Q9 Thats unlikely since FAPI has altered from D5 -> D6 and I'll focus on improvements than on creating a backport.
Comment #2
HansBKK CreditAttribution: HansBKK commentedQ1-3 - submitted issue #335433: Enable "pass-through" of filtered layout of embedded fields
Q4&5 - submitted issue #335438: Respect access control via CCK Content Permissions
Q6 What about storing the nids-->link of target nodes in an array in a CCK field within the source node? No not asking, just throwing it out there :)
User workaround in the meantime: define a "hidden for editor" CCK field in the source node with links to the target nodes referencing that source and manually edit it each time references are added or deleted.
Q7 Should be done by imagefield itself anyway shouldn't it. . .
Q8 Excellent, how close (ballpark do you reckon rc2 is - weeks, months. . ?
Q9 Sounds like a plan!
Thanks for such detailed answers and again, thanks for launching what looks to be an excellent and original new set of functionality for Drupal!
Comment #3
HansBKK CreditAttribution: HansBKK commented"This could be a task for Inline API. I recommend to mention it there."
Done http://drupal.org/node/80170#comment-1108966
Comment #4
Pepe Roni CreditAttribution: Pepe Roni commentedQ7: I did this with texy! filter, computed field and linodef!
1. added a computed field to my "image" node containing that image field. This computed field "field_filename" gets the filename from the image field.
2. defined a BuEditor button for inserting from "field_filename"
3. added linodef (and of course html-filter) to the texy filter and arranged them in this sequence: linodef (to change a linodef tag into a filename), texy! to do the texy stuff (eg. insert the image from a filename) and html-filter to remove disallowed html-tags.
My content then looks like this:
[* [nl#8:field_filename] *](old syntax)[* [#8:field_filename,nolink] *]
First, linodef transforms [nl#8:field_filename] into a filename, then the intermediate content will look like this:
[* myimage.jpg *]
Then, texy! transforms this into an img-tag.
Comment #5
Roi Danton CreditAttribution: Roi Danton commentedHehe, nice one. :)
Please heed that with Linodef rc2 the no link tags will change because I added this feature to term links also. They will look like [#IDnl] resp [#tIDnl]. If you already have many no link tags in your installation a search and replace module could come in handy upon upgrade to rc2. The dev version already uses the new tag layout. It is the first and likely the last time that something like that does change! (in an emergency I could provide a backwards compatibility but I'd like to avoid that additional code)
Q7 Filefield and Imagefield are storing a FileID and the other information in a serialized string. Hence to support that I can't use my functions as they are. Maybe I do that in a later version (not rc2). Until that time druppi found a neat solution. :)
Q8 Weeks.
Comment #6
HansBKK CreditAttribution: HansBKK commentedCorrect me if I'm wrong, but my understanding is that you're now able to display an image referenced by an imagefield inline with body content. True?
If so, KEWWL! Is this limited to same-node use, or could it be a way to get Image-module like referencing/re-use from a "container" node to more than one "displaying" nodes?
If the latter, could you please expand your example?
And I would suggest cross-posting to imagefield's queue, lots of people looking for this (if I understood it right)
Comment #7
Pepe Roni CreditAttribution: Pepe Roni commentedHere is the code for the computed field field_filename
$node_field[0]['value'] = $node->field_image[0]['filename'];
You see, it's really no secret. field_image is the system name of the image field, and my images (a cck-defined content type) contain only one occurrence of the field_image.
Here are my BuEditor buttons:
The "Insert image" button (linodef):
The "Image left" button (Texy!):
[* %TEXT% <] ***
and the "Image right" button (Texy!)
[* %TEXT% >] ***
You can then first press the "image left" or "image right" button, and then the "insert image" button.
An example would be:
[* [#nl5:field_filename] >] *** [#5]
In this example you would see the image and, as caption, the image title, as clickable link. For details see also the Texy! documentation.
I used image field to enable translation of images (without duplicating the images).
I also have some ideas about attaching images and referencing these in the content (place them into the content and not at the bottom of the content). But that will become another thread.
Comment #8
HansBKK CreditAttribution: HansBKK commentedPosted a note about this to the "re-use" issue on Imagefield http://drupal.org/node/119539
Comment #9
momper CreditAttribution: momper commentedsubscribing
Comment #10
SerenityNow CreditAttribution: SerenityNow commentedHi- This project sounds like exactly what I am looking for - unfortunately, I will be using 5.x. In your description for Linodef, you mention several other similar Drupal projects (internal link managers). Can you please list these other projects as an FYI, since there will not be any backport of Linodef to 5.x?
Thanks!
Comment #11
Roi Danton CreditAttribution: Roi Danton commentedThats right, there will be no backport of Linodef for Drupal 5 unless someone other than me is willing to do.
Search the contributed module list for filters. E.g. you'll find Pearwiki Filter or Freelinking (Camel Case and Wiki Syntax). However, I don't know of another module than Linodef that embeds content from other nodes or fields etc.
EDIT: Insert Node insert nodes and its fields. However the version for D5 has problems with infinite loops I stumbled across in past, too. If you use this module please give a feedback here since I've got to know about Insert Node just from that very moment. :)
Btw, from a point of view of an admin, I recommend to use D6 since it's much easier/faster to set up a site with views & CCK 2. Sorry for being Off-Topic. ;)
Comment #12
imclean CreditAttribution: imclean commentedThanks for the great idea, druppi (and of course the great module Roi). For linking to a FileField field I used a similar method.
Computed field (field_document_link):
$node_field[0]['value'] = l($node->title,file_create_url($node->field_file[0]['filepath']));
This creates a link from the document node title to the file which can then be inserted into the text using the normal method:
[#32:field_document_link]
Comment #13
Roi Danton CreditAttribution: Roi Danton commentedI added links to your instructions to the supported element types page in the documentation.
Comment #14
awakash CreditAttribution: awakash commentedHow would we use nolink option for pull say field_body from node id?
We can add nolink to tid (e.g. [#5,tid,nolink]), but what if we wanted to use nolink for this tag: [#2:field_body] ? I tried this but didn't work [#2:field_body,nolink]
Comment #15
Roi Danton CreditAttribution: Roi Danton commentedYou want to embed the default node body or you have a field called field_body?
Comment #16
awakash CreditAttribution: awakash commentedGood question - took me some time to figure out but I have a field called field_body. What I did was enable 'computed field' within CCK to make a hidden field that pulls the default node body (without appending the copy data into the database). So, now I have a field called field_body. Any ideas on how to use 'nolink' ? I would like for the text I'm pulling not to be a hotlink - and I'd like to prevent from hacking/changing the module myself.
Comment #17
Roi Danton CreditAttribution: Roi Danton commentedI did a test with the 'nolink' option and several fields (computed, text, number) using rc3 release. I could reproduce your problem that nolink and other options without values doesn't work everytime. I posted the bug and fix:#543694: Options without values are not heeded
Thanks for reporting that bug! Btw, the next version will support embedding node body by option. I never needed it since I use fields for everything.
Furthermore I close this issue since:
If you have a question please open a new issue so other users with the same question can find the answer quickly.
Comment #18
Roi Danton CreditAttribution: Roi Danton commentedComment #19
Roi Danton CreditAttribution: Roi Danton commentedCCK formatter support commited to D6 branch. Now Linodef (dev release) is capable of embedding all fields, including Image- and Filefields. Usage like always:
[#19:field_image]
(field_image = and image field of your site attached to node 19). Here the CCK formatter you set on your content type is used.You also can define another formatter for the field by writing:
[#19:field_image,formatter="formatter_name"]
Comment #21
Pepe Roni CreditAttribution: Pepe Roni commentedHere is another approach to embed an image from an imagefield into the node body:
In the node with the imagefield field_image define a computed field field_image_left, not stored into database!, with the following computed value:
In your embedding node you can refer to this field by [#id:field_image_left,nolink] and this will insert the whole html code for a teaser view image and a full node view image. The full node view image will also contain a caption (the description attribute. With css you have to omit the display of the full node image in teaser view and the display of the teaser image in the full node view. The larger image is linked to its node. (you also can omit the nolink, as in the current version the link is not placed correctly by linodef and thus does not work)
This is only a working example. It should lead you to more ideas what you can do with linodef and imagefield!
Comment #22
Roi Danton CreditAttribution: Roi Danton commentedThanks for sharing your approach! I have added a user tips section to the Linodef handbook pages. All user instructions should go there in future. Please add a child page with your instructions of #21 there, too.
Btw, I haven't looked into the details of your code but think using formatters should enable a similar result. However that could be discussed on the doc page. This issue should be reserved for bug reports or comments regarding the fields implementation. Marking as fixed so other users are getting attention to your instructions for 2 weeks.