Condition testing patch

LasseP - October 11, 2008 - 11:26
Project:Image
Version:6.x-1.x-dev
Component:image_attach
Category:feature request
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

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.

AttachmentSize
image_attach.patch2.41 KB

#1

LasseP - October 11, 2008 - 11:29
Status:active» needs review

forgot to set status to patch (code nees review), sorry.

#2

sun - January 17, 2009 - 21:16
Status:needs review» won't fix

Sorry, this issue is way too old to have a chance to get fixed.

 
 

Drupal is a registered trademark of Dries Buytaert.