Condition testing patch
| Project: | Image |
| Version: | 6.x-1.x-dev |
| Component: | image_attach |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Hi folks,
i created a patch for image_attach module (base was the HEAD from CVS, but i could't choose it in the "version" field), because i was missing some functionality. I hope the patch is done well, code has been checked by coder module. This is the first time i supply a real patch.
Background:
I'm using D6 with the paging module for some of my node types in addition with image_attach. The problem i had was, that i didn't want the attached image to be seen on any other page than the first page of a node.
Idea:
My idea was to add a condition testing to image_attach, to check weather the image should be attached or not. First idea was to use hook_form_alter and let drupal users save arbitary php code to check. Due to security issue with arbitary code, i decided to use another way. Including specific named files for condition testing.
Result:
The patch offers the possibility, to create a php include file ( *.cond.php) in the themes directory. Image_attach checks if one of the files in question exists (in the hook_nodeapi->load part), loads it, and then decides weather the attached_image should be loaded or not. It checks for these files:
imageattach-nid.cond.php
imageattach-type-nid.cond.php
imageattach-type.cond.php
imageattach.cond.php
(exact order, first match wins).
The files have to set the variable $returnvalue either to true or to false. True = display image, false = do not display.
Hope you like it. And if it's not well written, please help me to make it better.
| Attachment | Size |
|---|---|
| image_attach.patch | 2.41 KB |

#1
forgot to set status to patch (code nees review), sorry.
#2
Sorry, this issue is way too old to have a chance to get fixed.