Project:Custom filter
Version:6.x-2.x-dev
Component:Third-party modules integration
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

Hi.
I've created a patch that integrates customfilter with features.

It would be great if this one get committed.

AttachmentSize
customfilter_features-integration.patch6.23 KB

Comments

#1

Status:needs review» postponed (maintainer needs more info)

I find part of the code interesting, especially the part that allows third-party modules to modify the exported filters.

I don't understand the reason to create a dependency from another module just to allow users to import / export the filters they created. This means that users without fetures.module installed could not import / export any filters, even in the case they would just need to do that to share the same filters between different web sites.
What does features.module add that is not available from the code used from customfilter.module?

#2

There is no special dependency needed to import/export filters.
If you don't have features installed, customfilters behave as it does right now. But if you have features enabled you can export the filters as a feature.

Currently there is no way to export a feature that includes data from customfilter. The patch fixes this.

#3

What I meant to ask is what the vantage for Custom filter to use Features is. In which way would Custom filter be better, if it would integrate with Features?

#4

In which way would Custom filter be better, if it would integrate with Features?

Filters created by customfilter can be exported and integrated with features. This is a really great thing, because you can predefine several configurations and "features" that makes it easy to build powerfull sites.
Or look at OpenAtrium. If customfilter allows features to integrate its filters in a package, OpenAtrium (or every other feature-package) can define some default filters that are activated together with the feature-package.
This is not possible at the moment.

#5

If customfilter allows features to integrate its filters in a package, OpenAtrium (or every other feature-package) can define some default filters that are activated together with the feature-package.

Features would be then something similar to the installation profiles, which allow to customize a Drupal installation.
From your description, I get that I could create a feature called Wikipedia, and add custom filters that would allow somebody to use an input format similar to the one used to write articles on Wikipedia.org.

Did I understand correctly?

#6

Yes, exactly.
For example, I created a feature that builds a subscription management (with flag and rules and some custom code for email management).

Features can provide a wide bunch of functionality with a single click.
To enhance your example: it will be possible to create a wikipedia feature that includes *all* functionality of wikipedia (as long as all used modules support features). You can simply install the feature-package (that is exported as a simple module; ok, not quite simple, but it is a module) and have all the functions without having to configure them manually.

#7

Status:postponed (maintainer needs more info)» active

Thanks for you explanation, and for correcting my wrong assumption about the dependency on the module.

I will change the code to include the patch in the next 24 hours.

#8

Great. Looking forward the next release to build more cool features :-).

#9

Status:active» needs work

<?php
function customfilter_export_filter($filters = array()) {
 
$output = array();
 
$output = '$filters = array();'. "\n";
  foreach (
$filters as $filter) {
    if (!
is_array($filter)) {
     
// We got just the filter name, for example from the features
      // implementation.
     
$filter = _customfilter_get_filter($filter);
    }
   
$new_filter = (array) $filter;

   
// Allow other modules to change the exported filter.
   
drupal_alter('customfilter_export', $new_filter);

   
// Remove the flag ID.
   
unset($new_flag['fid']);

   
$output .= '// Exported filter: "'. check_plain($filter['name']) . '"' . ".\n";
   
$output .= '$filters[] = ' . var_export($new_filter, TRUE) . ";\n";
  }
 
$output .= 'return $filters;';
  return
$output;
}
?>

The variable $new_flag is not defined; unset($new_flag['fid']) is then unsetting a variable that has not been set.

Also, the code for exporting the filters is different from the code that is actually implemented from the module. It would be better to use the same method.

#10

+++ customfilter.features.inc 30 Oct 2009 15:52:25 -0000
@@ -0,0 +1,69 @@
+    $filter = _customfilter_get_filter($fid);
+    $export['features']['customfilter'][$fid] = $filter;

I don't like this. When you have a fid as indentification you need the same fid on every page. I think a machine readable name would be better like other modules uses it.

I'm on crack. Are you, too?

#11

@dereine: Custom filter doesn't implement a machine readable name, but has a filter name. Do you think it should implement a machine readable name as well?

#12

I think yes. Its better. There are some javascripts availible, for example in the features module, which autogenerates the machine readable name out of the name.

#13

I added a machine-readable name for the custom filters.

#14

Status:needs work» closed (won't fix)

There have not been replies in 25 weeks; I am changing the status consequently.

#15

Was this ever committed to the module? If not, does the patch above work, there seems to be discussion of changes to the patch but no updated one, or is there another way to integrate with the features module?

#16

No, as far as I know, there is no way to export a filter defined by customfilter. The original author seems to had no intentions to include it.

nobody click here