create a simple plugin functionality to easily swap the image system

Pasqualle - September 26, 2008 - 13:11
Project:jcarousel block
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

the first try:

<?php
$imagefield_type
= variable_get('jcarousel_block_imagefield_type', 'imceimage');
module_load_include('inc', 'jcarousel_block', $imagefield_type);
?>

imceimage.inc
imagefield.inc
directoryimage.inc

and all should have an equally named jcarousel_block_preprocess_image(&$variables) function, and any other function necessary.
this way it would be possible to add new types without altering the main module files..

---
it would be even better if custom modules can define their image system in their own space like views uses the module_name.views.inc files..

#1

Pasqualle - September 29, 2008 - 17:43

The basic plugin system.
The admin settings are not included, they are left in the module, as it is not possible to include files with the same function names. It would require additional include files per image type (like imceimage.settings.inc)

directory structure should be:
jcarousel_block.module
includes/imceimage.inc
includes/imagefield.inc
includes/directoryimage.inc

attached the patch for the module, but also attached the final (patched) module file, if there would be a problem applying the patch..

AttachmentSize
plugin_313835.patch 11.69 KB
imagefield.inc_.txt 951 bytes
imceimage.inc_.txt 1.99 KB
jcarousel_block.module.txt 8.4 KB
directoryimage.inc_.txt 2.34 KB

#2

Pasqualle - September 29, 2008 - 16:51
Status:active» needs review

#3

Pasqualle - October 5, 2008 - 23:03

improved directoryimage plugin

AttachmentSize
directoryimage.inc_.txt 1.91 KB

#4

yang_yi_cn - October 6, 2008 - 16:37

Thanks for that. I'm currently busy and don't have too much time to make a new release for that. However, when I do have time, I'm thinking about integrate some video module as well, maybe embedded meta field module. So the next release will not be there very soon.

#5

yang_yi_cn - October 28, 2008 - 22:11
Status:needs review» fixed

commited

#6

Pasqualle - October 28, 2008 - 23:53

I wanted to suggest to name the functions differently by image plugin type, but you fixed that already. Nice one.

#7

Anonymous (not verified) - November 12, 2008 - 00:01
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.